![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| get_source[34]: 0403-057 Syntax error at line 66 : `"' is not matched. | vishal_ranjan | Shell Programming and Scripting | 1 | 05-15-2008 07:48 AM |
| extracting a line based on line number | narendra.pant | Shell Programming and Scripting | 2 | 09-20-2007 06:00 AM |
| How to get a next line of a matched word? | Muktesh | Shell Programming and Scripting | 10 | 08-06-2007 11:17 PM |
| getting the line number by extracting a line | bishweshwar | Shell Programming and Scripting | 2 | 08-04-2007 10:46 AM |
| sed, grep, awk, regex -- extracting a matched substring from a file/string | ropers | Shell Programming and Scripting | 2 | 05-23-2006 02:56 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK - Extracting matched line
Hi all,
I have one more query related to AWK. I have the following csv data: Code:
,qwertyA, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 ,qwertyB, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 Code:
nawk -F"," ' /qwertyA/
{print $0}
'
Any suggestions on doing this please? |
|
||||
|
This is the data to work on:
Code:
,qwertyA, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 ,qwertyB, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 Code:
,qwertyA, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 Thanks again, |
|
||||
|
Hi thanks again for the suggestions,
The data to be working on is: Code:
,qwertyA, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 ,qwertyB, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,100,200 ,,,,,,,,,,,,,,,,,,,300,400 ,qwertyC, field1, field2, field3, field4, field5, field6 ,,,,,,,,,,,,,,,,,,,1200,2300 ,,,,,,,,,,,,,,,,,,,3200,4400 Doing it manually I would look for the first instance of the data with qwertyA and then get all the lines beneath that untill I come across another line which doesnt contain the list of "," (the lines that are italicised)... Hope thats a bit clearer, |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|