Grueben
September 26, 2010, 6:39am
1
Hi All,
I have a file containg lines along the likes of:
18:02:00 JOB02084722
18:09:00 2010120942
18:12:04 JOB02084723
18:34:16 20100709
etc.
What I want to do is remove the entire line when field 2 starts with a number so I'm left with:
18:02:00 JOB02084722
18:12:04 JOB02084723
I can't use awk to remove all numberics because they appear validly in some of the jobnames. I've had a look through a lot of awk and sed stuff but can't seem to find it. Any help much appreciated.
G
kurumi
September 26, 2010, 7:37am
3
$ ruby -ane 'print if $F[1]!~/^\d/' file
18:02:00 JOB02084722
18:12:04 JOB02084723
Grueben
September 26, 2010, 8:01am
4
Thanks for that it works fine but I forgot to add that sometimes the file contains a blank record in field 2.
Could you help with the awk for removing ALL non-aplha characters?
Scott
September 26, 2010, 8:58am
6
Your question isn't clear.
Define a "blank record". Does that mean "no record"? "remove all non-alpha characters" from where?
rdcwayx:
sed '/ [0-9]/d' infile
This wouldn't work if there is no second record, if the second record has any numbers or if there are more than two records.
Grueben
September 26, 2010, 10:44am
7
Cheers Scottn. The file looks like:
18:02:00 JOB02084722
18:06:00
18:09:00 2010120942
18:12:04 JOB02084723
18:34:16 20100709
Basically all I want from it are the lines where the 2nd field starts with 'JOB'. All other lines can be deleted. Appreciate your help