Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a file which looks like :

Status
Not open for further replies.

ianholmes

Programmer
Mar 24, 2001
61
0
0
GB
I have a file which looks like : k4renas^M^[[B
The ^M is one character, as is the ^[ after it.
How do I use cut/grep to extract only the ascii characters
at the front of the record ( ie k4renas ? ) ?
 
I believe grep will return the whole line. You may want to use sed instead.
 
in vi, enter

:%s/^M.*//

Get ^M by entering cntl-v cntl-m

Or create a file, t.sed say, containing

s/^M.*//

and enter

sed -f t.sed input-file CaKiwi
 
or similarly with sed:

sed 's/\(.*\)'`/usr/bin/echo "\015"`.*'/\1/g' myInputFile.txt vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
If you are on a Sun box try:
dos2unix filename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top