Sponsored Content
Top Forums Shell Programming and Scripting How to store it in a file and help with code?? Post 302493630 by Diddy on Thursday 3rd of February 2011 10:50:59 AM
Old 02-03-2011
Its Working...Thanks..and Sorry for bothering you.. I am still in learning stage, don't know how to use those commands. Thanks for your help. Can you please explain that if you have time!
Code:
AWK -F\| 'NR==FNR{n=int($2); a[n]=$2; next}
a[$1] Here am trying to understand it like this.
NR==FNR // file1==file2 

{

n=int($2);//n=53031-SC98 ;

a[n]=$2;//a[0]=53031-SC98 , a[1]=.....

next //??? here i dont understand

}

a[$1] // picking a[0] i.e 53031-SC98

{

print a[$1] FS $2 // printing .. O/P:: 53031-SC98 |Revenue - Cigarette Stamping

}

Here i am not able to understand how and where they are compared and printed???? please help me out


Thanks

---------- Post updated at 09:20 PM ---------- Previous update was at 07:23 PM ----------

Some one explain this please...Thanks
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Store return code of shell script in oracle table

Hi friends, I have to do the following things : 1) there should be a shell script returning the returning the return code of the script. and i have to add some more details like on which machine is has run , at what time and other details and then using plsql i have to add a row to Oracle... (3 Replies)
Discussion started by: sveera
3 Replies

2. UNIX for Dummies Questions & Answers

Need to create .bat file to store log file

Hi guys. Can someone point me to a resource that explains this? Basically these are websphere logs that need to be stored daily, I'm on sunOS 5.8. Each new file stored could have the current time as its filename. The script could be run on a cron which I can set up. I'm just not sure how to write... (0 Replies)
Discussion started by: dirtybrown
0 Replies

3. Shell Programming and Scripting

How to store Data in a File

I want to read a data from a read command and store it in a file...... Plz send me how I can do that Ex: read val and I want to store this val in a file called temp. (2 Replies)
Discussion started by: krishna_sicsr
2 Replies

4. Shell Programming and Scripting

To read and separate number and words in file and store to two new file using shell

hi, I am a begginer in unix and i want to know how to open a file and read it and separate the numbers & words and storing it in separate files, Using shell scripting. Please help me out for this. Regards S.Kamakshi (2 Replies)
Discussion started by: kamakshi s
2 Replies

5. UNIX for Dummies Questions & Answers

How to grep and store in a file

Guys, I was wondering what command can be used to parse the "LaxOrdID" field into a separate file? These messages are in thousands and I need to perform a comparision. (6 Replies)
Discussion started by: DallasT
6 Replies

6. UNIX for Dummies Questions & Answers

Writing a script that will take the first line from each file and store it in an output file

Hi, I have 1000 files names data1.txt through data1000.txt inside a folder. I want to write a script that will take each first line from the files and write them as output into a new file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

7. Shell Programming and Scripting

Store and isolate bad pages from a file to new file

I have a file like below . The good pages must have 3 conditions : The pages that containing page total only must have 50 lines. The pages that containing customer total only must have 53 lines. The last page of Customer Total should be the last page. How can I accomplish separating good... (1 Reply)
Discussion started by: ehabaziz2001
1 Replies

8. Shell Programming and Scripting

Hit multiple URL from a text file and store result in other test file

Hi, I have a problem where i have to hit multiple URL that are stored in a text file (input.txt) and save their output in different text file (output.txt) somewhat like : cat input.txt http://192.168.21.20:8080/PPUPS/international?NUmber=917875446856... (3 Replies)
Discussion started by: mukulverma2408
3 Replies
All times are GMT -4. The time now is 03:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy