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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove unwanted characters

Status
Not open for further replies.

mrcuser

Technical User
Aug 26, 2008
22
GB
I have the following strings of data:

07/15/09 19:00:00,07/15/09 19:14:35,1900-WKDAY_INC,KN-ECS,Failed 12
07/15/09 20:00:00,,2000_INC,KN2-DIA-P0001,Missed

but only need the following:

07/15/09 1900-WKDAY_INC,KN-ECS,Failed 12
07/15/09 2000_INC,KN2-DIA-P0001,Missed

When I try to awk out the relevant parts using $2 it hit errors as $2 sees the 20:00:00,,2000_INC,KN2-DIA-P0001,Missed as one column so ignores the whole string. Anyway to correct this ?
 

Try:
Code:
cut -d',' -f 3- <data_file >out_file
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Sorry I didn't paste the code as it was a simple

cat file|awk '{print $1,$2}' grep -v :

Thanks for the solution i'll try that now....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top