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!

How move unwanted lines in a file to another file

Status
Not open for further replies.

RJSHA1

Programmer
Apr 12, 2001
66
0
0
GB
Hi there,
I have a file like this

1Header
2data
2data
3trailer

I want to remove all the data lines, they start with a 2, where columns 31&32 have a value other than zero. The lines have no spaces ie.e. they are all zero filled (so that rules out AWK i think)

Does anyone have any suggestions as to how I do this, as my shell scripting is patchy at best and I'm stuck!!!

Thanks
 
Before you rule out awk, try...

awk '/^2.{29,30}[1-9]/{next};1' file1 > file2
 
nawk '/^2/ && (substr($0, 31,2) != "00")' myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks guys the nawk does what I want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top