![]() |
|
|
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 |
| column 1 line transitions part two! | ajp7701 | Shell Programming and Scripting | 7 | 04-18-2008 06:16 PM |
| how to read the column and print the values under that column | gemini106 | Shell Programming and Scripting | 6 | 03-28-2008 07:05 AM |
| print a line containing word in a column using grep | useless79 | Shell Programming and Scripting | 2 | 11-23-2007 04:32 AM |
| to print column using awk | cdfd123 | Shell Programming and Scripting | 2 | 07-26-2007 02:15 PM |
| Print the line containing the maximum value in a column | kingkong | UNIX for Advanced & Expert Users | 22 | 02-03-2006 10:38 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
print line before column 1 transitions
I have a space delimited text file with thousands of lines, COLA.TXT that looks for example like this:
AA 123 456 789 AA 987 987 987 AA 987 988 888 AA 999 999 999 B 123 456 789 B 111 111 111 CCD 123 456 789 CCD 321 654 987 CCD EE 11 11 EE EE EE 00 00 00 EE Anyway, I need a script that will print the first and last line of each transition of the first column. In other words it will print the first and last lines of each "section". Sample output might look something like this: AA 123 456 789 AA 999 999 999 B 123 456 789 B 111 111 111 CCD 123 456 789 CCD EE 11 11 EE Note when there are only two lines in a section (B) it still prints the first and second lines. there are always at least 2 lines. sometimes there are 10+ lines though. I see this as being pretty complicated? I dont know though, everybody on here is amazing!!! Thank you so much in advance! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|