Need to find the string
|
Original Message
|
Name: ahmedwaseem2000
Date: July 7, 2005 at 08:23:11 Pacific
Subject: Need to find the stringOS: UnixCPU/Ram: 256 |
Comment: Hi , Can any one of you tell me how to find the 5 characters after the 5th occurance of a ","(comma) in a data file for all the rows of the file. As i am still naive with unix scripting Many Thanks, Waseem
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: vicchai
Date: July 7, 2005 at 19:00:14 Pacific
Subject: Need to find the string |
Reply: (edit)Hi Waseem, If you means all occurance in one line, you can try this: tr "," " " < datefile | awk '{print $6}' | cut -c 5
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: ahmedwaseem2000
Date: July 7, 2005 at 22:40:06 Pacific
Subject: Need to find the string |
Reply: (edit)Hi Victor, Thanks for all your help. May i ask you for one more favor if possible for you. now i have 2 files one data file and the other parameter file. from parameter file i have to pick a value and perform some calculations and place it at the end of the corresponding line number in the data file. Could you please help again. Many Thanks, Waseem
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Jim Boothe
Date: July 8, 2005 at 08:37:29 Pacific
Subject: Need to find the string |
Reply: (edit)FYI, the tr solution above that changes the comma-delimited data to space-delimited data will fail when the data contains spaces such as: 15023,Jim Boothe,123 Main Street,O-positive Just let awk process it as comma-delimited data: awk -F, '{print $6}' datafile | cut -c-1-5
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: