Please help!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please help!!!
# 50  
Old 07-21-2006
I did not see a mention of the systems being used as I scanned this thread. mhssatya and dsravan, please type the command:
uname -a
and paste the results in a post. This information may help our experts help you more effectively. Thanks.
# 51  
Old 07-21-2006
Could you please both save me a few posts here and COPY+PASTE the code I posted last into a file, do not transcribe it by hand.

If that is for some reason not possible, please you ensure that you have correctly reproduced it before posting again.

` <--- that is a backtick
' <--- that is a single quote

Last edited by reborg; 07-21-2006 at 07:52 PM.. Reason: spelling. again!
# 52  
Old 07-21-2006
Perderabo,

Here is the ouput:

HP-UX drwatson B.11.00 B 9000/800 615399343 16-user license
# 53  
Old 07-21-2006
Reborg,

I am sorry that I copied wrongly. The code is working now but IF i have 2 files namely CARE01_DLY_AUS_20060721 and CARE01_DLY_MKT_20060721
It's creating only 1 new file named CARE01_DLY_MKT_20060721 _new. But what happened to the other file namely CARE01_DLY_AUS_20060721 _new. It's writing only 1 file.

Once again I am sorry to copy it worngly. It happened because i copied wrongly.
# 54  
Old 07-21-2006
ok now change the awk part to this (make sure you leave $files the at the end which I have not shown here)

All that has chaned is some occurrences of FNR are now NR.

Code:
awk '{data[NR] = $0; out=FILENAME "new"; file[NR]=out;} END { if ( FNR - 2 == $1) { for ( i=2 ; i < NR; i++ ) { print data[i] > file[i] }  close(file[i])}else { print "error"} }'

# 55  
Old 07-21-2006
Reborg,

The server is down. I will try once it is up and running. Smilie
# 56  
Old 07-21-2006
Reborg,

The server is up and running. Here is the output. It still didn't create 2nd file.

+ dev=/biddf/ab6498/dev/ctl
+ cd /biddf/ab6498/dev/ctl
+ echo /biddf/ab6498/dev/ctl
/biddf/ab6498/dev/ctl
+ + date +%Y%m%d
files=CARE01_DLY_???_20060721
+ echo CARE01_DLY_AUS_20060721 CARE01_DLY_MKT_20060721
CARE01_DLY_AUS_20060721 CARE01_DLY_MKT_20060721
+ awk {data[FNR] = $0; out=FILENAME "_new"; file[FNR]=out;} END { if (
FNR - 2 == $1) { for ( i=2 ; i < NR; i++ ) { print data[i] > file[i]}
close(file[i])}else { print "error"} } CARE01_DLY_AUS_20060721
CARE01_DLY_MKT_20060721
awk: A print or getline function must have a file name.
The input line number is 5. The file is CARE01_DLY_MKT_20060721.
The source line number is 1.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question