How do I remove the last two chars from each line in a text file using just Linux commands?
Also my file seems to have weird ^A delimiters in it. What char does ^A correspond to?
A periodic computer generated message (simplified):
Hello user123,
- (604)7080900
- 152
- minutes
Regards
Using python, how can I extract "(604)7080900", "152", "minutes" (i.e. any text following a leading "- " pattern) between the two empty lines (empty line is the \n\n after "Hello user123" and the \n\n before "Regards"). Even better if the result string list are stored in an array. Thanks!
Not that I would want to use this practically (for many reasons) but out of strict curiousity I would like to know if there is a way to reverse order a string using LINQ and/or LAMBDA expressions in one line of code, without utilising any framework "Reverse" methods.
e.g.
string value = "reverse me";
string reversedValue = (....);
and reversedValue will result in "em esrever"
EDIT
Clearly an impractical problem/solution I know this, so don't worry it's strictly a curiosity question around the LINQ/LAMBDA construct.
I was just messing around with Apple's GLPaint sample app to learn more about OpenGL, and I noticed that whenever you draw a line, it's always preceded by a dot. Basically, it looks like:
.________
Does anyone know why this happens? I'm guessing it's some weirdness with touchesBegan/Moved/Ended, but I can't verify. It's been driving me crazy all morning!
I want to create a makefile variable that is a multi-line string (e.g. the body of an email release announcement). something like
ANNOUNCE_BODY="
Version $(VERSION) of $(PACKAGE_NAME) has been released
It can be downloaded from $(DOWNLOAD_URL)
etc, etc"
But I can't seem to find a way to do this. Is it possible?
With vim how do I to turn this:
t.string :crypted_password :null => false
t.string :password_salt, :null => false
into this:
t.string :crypted_password, :null => false
t.string :password_salt, :null => false
without manually adding the spaces to each line?
I have a C# string object that contains the code of a generic method, preceded by some standard C-Style multi-line comments.
I figured I could use System.Text.RegularExpressions to remove the comment block, but I can seem to be able to get it to work.
I tried:
code = Regex.Replace(code,@"/\*.*?\*/","");
Can I be pointed in the right direction?
My input file content is
welcome
welcome1
welcome2
My script is
for groupline in `cat file`
do
echo $groupline;
done
I got the following output.
welcome
welcome1
welcome2
Why it is not print the empty line. I want the reason.
My application builds and prints HTML reports using AxWebBrowser.ExecWb method. Lately each time a report is printed a thin horizontal line is printed across it. It's not supposed to be there, it doesn't appear in any preview (Word, browser), but it's always there on the paper, always at the same absolute location and regardless of the printer type. Any ideas?
Hi,
I have a line chart with four lines:
- Total
- A
- B
- C
It is a only a limited number of lines, and I want to allow the user to specify via input parameters what lines to show (i.e. ShowTotal, ShowA, ShowB, ShowC booleans).
Can it be done, and how?
Let say i want to read the integers a, b and c from stdin (in one line, do not need to press return after each number). In c++, i would just do:
cin a b c;
How to do this in Python ?
Hi,
I have drawn NSTextView object on NSView, which i added by calling addSubview method.
When I enter text and press enter text i had entered come down by one line correspondingly.
What can be the reason behind it, and how to cope with this problem.
When I use \LaTeX{} to show the LaTeX logo, the following line of text is pushed down in order to accommodate the subscript 'E' in LaTeX.
How do I override this? Is there an option I can pass to \LaTeX{} ?
I would like to insert a line break into the first space between words in a string variable. Here is my code so far:
<cfset myPosition = find(" ", #myVar#)>
<cfset lineBreak = Chr(13)&Chr(10)>
<cfset myVar = insert(#lineBreak#, #myVar#, #myPosition#)>
What am I doing wrong?
Web config has debug=true and the project is a debug build and the pdb files are present in the bin directory, but I do not get line numbers in my stacktrace when an execption is thrown.
Works fine with local IIS/Cassini but not on our test IIS servers. Is there some obvious setting that I might be missing?
I have alignment file and long record in it. Suppose while displaying to an end user i want to show Sequence ID and 50 sequences in each line and continue further till the end of file.
Can anyone suggest me algorithm or example code in python.
Thanks in advance
How can I write to files using Python (on Windows) and use the Unix end of line character?
e.g. When doing:
f = open('file.txt', 'w')
f.write('hello\n')
f.close()
Python automatically replaces \n with \r\n.
Is it possible to create, for instance, a box model hack while using in-line CSS?
For example:
<div id="blah" style="padding: 5px; margin: 5px; width: 30px; /*IE5-6 Equivalent here*/">
Thanks!
\documentclass{book}
\usepackage{amsmath}
\usepackage[german]{babel}
\usepackage{amssymb}
\usepackage{amsxtra}
\usepackage[dvips]{epsfig,psfrag}
\usepackage{listings}
....
this is how my file starts. I didn't even edit it, I received it like this. However, if I want to make a pdf, it gives me the undefined control sequence error at the first line... What is wrong??
Hi,
I'm getting this error when trying to restore an SSAS database from a backup:
The ddl2:MemberKeysUnique element at line 63, column 4862 (namespace http://schemas.microsoft.com/analysisservices/2003/engine/2) cannot appear under Load/ObjectDefinition/Dimension/Hierarchies/Hierarchy.
Google hasn't turned up any helpful solutions. (a lot of people found that installing SP2 made the error go away but this has always previously worked in our environment)
I don't really understand what the error means. Can somebody interpret or suggest a fix?
Thanks,
Phil
hi,
I'm using Drupal for a website, and I've a link "Unselect All" to deselect all items.
How can I remove the dotted line around "Unselect All" when I click on it ?????
This is the link: http://www.sanstitre.ch/drupal/
thanks
Hello
I already wrote a program that read locations from android GPS ; each locatin(long , lat) will be sent to remote server to save it and display it in a website map.
what I'm trying to do now is to display my path in android by drawing line between the points
I didn't find any sufficient answer until this moment! so how this can be done?
I wrote a foreach loop for my datagridview to write all rows to txt file.
I have a problem as it adds 2 empty lines at the end, as 1 row is full of empty cells after adding/reading to datagrid view.
Is there any way to omit the last line or delete it in txt?
foreach (DataGridViewRow item in this.DB.Rows)
{
foreach (DataGridViewCell item2 in item.Cells)
{
if(item2.Value != null)
filewrite.Write(item2.Value.ToString() + " ");
}
filewrite.WriteLine("");
}
I am trying to remove all the " from a string called s1, I have this line
s1=replace (s1, """, "")
But i get a complile error saying it is expecting a list seperator or )
How can i fix it?
Thanks in advance
I used Term::shellUI module and almost every thing
is working as expected but the issue is when I pressed ctrl+c I want to
print "Please use ctrl+d to exit the shell" ,
for that I handle the signal but the message print only after I pressed the new line
how to resolve this !
Thanks in advance !