![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Formatting of file to an desired one | pkondur | Shell Programming and Scripting | 5 | 04-01-2008 10:26 PM |
| chmod not working as desired | JamesByars | UNIX for Dummies Questions & Answers | 2 | 02-21-2008 10:30 AM |
| Desired Format ! | prasanth_babu | HP-UX | 1 | 02-20-2008 07:31 AM |
| Help me in getting the desired output | akash | Shell Programming and Scripting | 2 | 12-02-2007 08:27 AM |
| get the timestamp of a file in desired format | sumeet | UNIX for Advanced & Expert Users | 1 | 03-08-2007 09:24 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Please Read REBORG
Reborg,
Sorry to bother you. I have tried the code you suggested and it's not creating new files after they satisfy the criteria. If any of the files don't satisfy the criteria it should not create the files at all. Please see my output below. Quote:
Last edited by mhssatya; 08-17-2006 at 03:48 PM. Reason: Reborg can answer it faster if he sees it!!!! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Satya,
I see that in your script you are using ARGIND and ARGC which are specific to nawk and gawk languages and it will not work for you if they are not installed on your system. Other than that I think Reborg should help you with the code he wrote. Thanks |
|
#3
|
|||
|
|||
|
Thanks Sravan.
Reborg, I don't have either nawk or gawk installed and hence the script is not working as desired. Is think there is a way to solve this as we got the incorrect output before? Kindly suggest. I am just getting the name of the files when I run the script. So please help. Code: Quote:
|
|
#4
|
||||
|
||||
|
Can you post the output of
uname -a again, I think it was HPUX, but am not certain. |
|
#5
|
|||
|
|||
|
Reborg,
Here is the output of uname -a HP-UX drwatson B.11.00 B 9000/800 615399343 16-user license |
|
#6
|
||||
|
||||
|
That's what I though, HPUX replaced both awk and nawk with a new version of awk in 11.
This may work, but I don't have a HPUX machine, and don't know exactly how HPUX awk will behave. Code:
awk '{data[NR] = $0; out=FILENAME "new"; file[NR]=out; records[out]=NR } END { for ( r in records ) { sum += data[records[r]]; print sum } print ARGC, NR, NR - (--ARGC * 2); if ( sum != NR - (ARGC * 2) ) { print "error" } else {for ( i=2; i < NR; i++ ) { print data[i] > file[i] } close(file[i])}}' $files
|
|
#7
|
|||
|
|||
|
Reborg,
I really salute your skills. Let me give it a try. I will revert back with results. |
|||
| Google The UNIX and Linux Forums |