If your files are all like this and you want to process them on UNIX Systems and you want to keep carriage return characters in your file that do not appear at the end of a line immediately before a newline character, the following should work:
(where the ^M in the sed substitute command is a literal carriage return character; not the two characters ^ and M).
Using tr -d or dos2unix is simpler than sed if it is OK to get rid of all carriage return characters (instead of only those that appear at the end of a line).
Hello I'm trying to write a shell script which can remove a carriage return and/or line feed from a file, so the resulting file all ends up on one line.
So, I begin with a file like this
text in file!<CR>
line two!<CR>
line three!<CR>
END!<CR>
And I want to end up with a file... (1 Reply)
Hi,
I have a file called inp.txt
the contents of the file are as follows
MANI123|23|41
MANI123|96|23
I want to reove the first line of this file. How can I do it.
Thanks in advance (5 Replies)
Hi All,
I would like to know how to remove text from a line in a file.
eg
to
The 4 sets of numbers are not static ie they change on each line in each different file so if anyone can help that would be great.
Jeremy (10 Replies)
Hi, I searched the forums but could not find anything that was very useful. I am trying to remove the very last line from a file and display the rest of the file.
Is there a way to use cut and tail together? Any other suggestions? Thanks (8 Replies)
How can I remove the last character from each line of a file?
This must be done without "funny" characters, as I want to transfer the code to/from Windows.
Any ideas? (17 Replies)
Hello ,
I got a text file like that with many same line
main/a/antlr/
main/a/apache2/
main/a/app-install-data-ubuntu/
main/a/apparmor/
main/a/apport/
main/a/apport/
main/a/apport/
main/a/apport/
main/a/apr-util/
main/a/apr-util/
main/a/apt/
main/a/apt/
main/a/apturl/the output... (1 Reply)
I have tried a lot, Need your help guys.
SAS Program:
data one ; /* Data step */
Input name $; /*Dec variables*/
I want to remove the commented part(/* Data step */) alone. I have tried using sed command but it is deleting the entire line itself. i need unix command to separate this and... (6 Replies)
i have to remove the commented (/* . . . .*/) part which starts in one line and ends in other.help me with generic code because i have 1000 to 10k lines code which i have to remove.
data one;
set work.temp;
input name age;
infile filename;
/* dfsdf
dsfs
sdfdf
dsdd
sdfsf
sdfsf
sfs... (4 Replies)
Hi All,
In my output file i am getting control m character and also the line feeds at different places and with different combinations, the content of the file is supposed to be in a single line but if there is a line feed in between then from there onwards it's going into new line.
I tried... (7 Replies)
Hello guys,
I would need to remove the last character ")" of a specific line. This can be from any line. Your help is appreciated. Below is the line.
HOSTNAME=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP))
Please help. (6 Replies)
Discussion started by: sang8g
6 Replies
LEARN ABOUT NETBSD
asa
ASA(1) BSD General Commands Manual ASA(1)NAME
asa -- interpret carriage-control characters
SYNOPSIS
asa [file ...]
DESCRIPTION
The asa utility reads files sequentially, mapping FORTRAN carriage-control characters to line-printer control sequences, and writes them to
the standard output.
The first character of each line is interpreted as a carriage-control character. The following characters are interpreted as follows:
<space> Output the rest of the line without change.
0 Output a <newline> character before printing the rest of the line.
1 Output a <formfeed> character before printing the rest of the line.
+ The trailing <newline> of the previous line is replaced by a <carriage-return> before printing the rest of the line.
Lines beginning with characters other than the above are treated as if they begin with <space>.
EXIT STATUS
The asa utility exit 0 on success, and >0 if an error occurs.
EXAMPLES
To view a file containing the output of a FORTRAN program:
asa file
To format the output of a FORTRAN program and redirect it to a line-printer:
a.out | asa | lpr
SEE ALSO f77(1)STANDARDS
The asa utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'') and to X/Open Commands and Utilities Issue 5 (``XCU5'').
AUTHORS
J.T. Conklin, Winning Strategies, Inc.
BSD September 23, 1993 BSD