![]() |
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 |
| how to delete records with the given line numbers | mad_man12 | Shell Programming and Scripting | 5 | 3 Weeks Ago 03:09 AM |
| records in a line | theshashi | Shell Programming and Scripting | 7 | 10-02-2009 06:06 PM |
| delete records using line number(NR) | tkbharani | UNIX for Advanced & Expert Users | 3 | 01-31-2008 09:56 AM |
| AWK Multi-Line Records Numbering Problem | RacerX | Shell Programming and Scripting | 3 | 11-01-2007 10:44 AM |
| AWK Multi-Line Records Processing | RacerX | Shell Programming and Scripting | 10 | 10-18-2007 08:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
![]() I´m new on this Linux groups and like to learn more, Right now, I´m working on a project (personal) and have a question fallowing problem I´m making a bash script to read many files and extract some fields and separate them according certain criteria, let say a have a big file with records like these 210,linux 211,linux 220,windows 230, solaris 240, linux 250,ubuntu Now I made an awk process to make 4 different files: Linux.txt 210,linux 211,linux 212, linux ….219 Windows.txt 220,windows…220 Solaris.txt 230.solaris…239 Ubuntu.txt 250,ubuntu…259 Here is where the fun begin, I already remove field 2 from each file, but can not make all records on a singled line, I need them all like look this Linux.txt 210,211,212,…219 Windows.txt 220…229 Solaris.txt 230,…230 Ubuntu.txt 250,…259 Any help would be appreciated. ![]() Zopilota |
|
||||
|
Hi,
Hope it was a homework. ![]() This is what I have so far. Code:
while read line ;do
grep $line $fileTre | awk 'BEGIN {FS = ","} ; {print $59}' >> $line'_'$fileFor
done < $fileTwo
Get $line value whish is normali a name (let say linux in first place) from $fileTree and extract only field $59 (210, 211…219) and make a new file $line_$fileFor wich would be linux_fileFor for example. Last edited by Franklin52; 2 Weeks Ago at 05:39 PM.. Reason: Please use code tags!! |
|
||||
|
Ok, I hope I'm wrong.
Code:
awk -F, '{a[$2]=a[$2]?a[$2]FS$1:$1}END{for(i in a){print a[i] > i ".txt"}}' file
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|