|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | 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. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
I have a huge file and want to separate it into several subsets.
The file looks like: C1 C2 C3 C4 ... (variable names) 1 .... 2 .... 3 .... : 22 .... 23 .... I want to separate the huge file using the column 1, which has numbers from 1 to 23 (but there are different amount of lines for each number). I tried to use the loop looks like this: @ i = 1 while ($i <= 23) grep ^$i hugefile.txt > $i.txt @ i ++ end But there is one problem that for 1.txt, it will include all lines started with 1, 10, 11,..19 I tried to use grep "\<$i\>" instead, but it doesn't work too. Since in the other columns might contain numbers 1 to 23, and will add into the wrong files. I am thinking maybe I can awk all the columns if column 1 = $i? Is there any suggestion for this situation? Thank you in advance |
| Sponsored Links |
|
|
|
|||
|
I have somewhat similar problem.
Hello, I have a file with junk characters at the beginning of the file. Pls advice how could i bypass these junk characters. Sample file is given below.I want to extract the data starting from CREATE keyword to till end of the file. SQL08029QDB2/AIX6400AIX 64BIT@MADMS012009-07-13-00.05.04.732394PSQLASC_ANNUALIZEDRATEOFRETURNACTIVITY"SQL080226170053405MADMS01I MADMS01LDID074"SYSIBM","SYSFUN","SYSPROC","LDID074"%P5270293MADMS01*SPACE RESERVED FOR FUTURE*ÉPVM 00SQL08029QDB2/AIX64ÿÿÿÿSQL090513152703000 ¸°ñÿÿÿÅÿÿÿÿñÿÿÿÿÁÿÿÿÿ ñÿÿÿÿ¨ñÿÿÿÿ°ñÿÿÿÿ¸ÁFHÿÿÿÿÁ$&GÀkÀÀðÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿKÿÿÿÿÿÿÿÿCREATE PROCEDURE"MADMS01I"."ASC_ANNUALIZEDRATEOFRETURNACTIVITY" (IN "GUIDPOLICYGUID" VARCHAR(36), IN "DPERIODSTARTDATE" TIME END |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Grep and delete lines except the lines with strings | vj8436 | Shell Programming and Scripting | 14 | 04-17-2009 12:25 PM |
| print only matched string instead lines in grep | anchal_khare | Shell Programming and Scripting | 3 | 02-18-2009 04:34 AM |
| How to print lines till till a pattern is matched in loop | anoopvraj | Shell Programming and Scripting | 3 | 10-30-2008 10:36 PM |
| sed replaces all matched strings!!! | melanie_pfefer | Shell Programming and Scripting | 1 | 08-07-2008 12:40 PM |
| SED: match pattern & delete matched lines | not4google | Shell Programming and Scripting | 7 | 11-22-2006 09:58 AM |