Please Help required.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please Help required.
# 1  
Old 10-23-2008
Java Please Help required.

Hello guys I am new to awk programming. I need the below required script which can perform the following.
I have a file containing below data.

SNA NoCRD = 131
SNA OBarr = 3
SNC NoCRD = 76
SNC OBarr = 1
SND NoCRD = 155
SND OBarr = 5
SNE NoCRD = 100
SNE OBarr = 1
SNF NoCRD = 131
SNF OBarr = 5
SNG NoCRD = 123
SNG OBarr = 2
SNH NoCRD = 129
SNI NoCRD = 121
SNI OBarr = 3
SNJ NoCRD = 124
SNJ OBarr = 4
SNK NoCRD = 118
SNK OBarr = 3
SNM UnK = 5
SNM NoCRD = 391
SNM OBarr = 3
SNN NoCRD = 101
SNN OBarr = 7.
I want to replace the codes with a number but with a format like,

If it is SNA then just print only a digit like 1. since in my case I have SNA for 2 times with two more values, so I want to print only a one line above those 2 values but not with SNA infront of each line. similarly i want to do for the rest of the file. and then dump it in a new file.

Kindly help me in this regards. I will be very grateful.

Thanks in Advance
# 2  
Old 10-23-2008
I've down this with arrays. (hint!) Populate the array in the main body of your awk script and use the END part of your script to output the contents of the array. (hint:hint!)

HTH
# 3  
Old 10-24-2008
Unable to get idear.

Dear I am very new to awk. Kindly help me with code example. or provide a code for the mentioned case.

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help required

Hi Everyone, I need a little help in manipulating a file. This is what I need. I need to move each line barring the top 3 lines, to the right by a 8 (or some specified number ) of places. Example BEGIN: Vertices Edges Archs 1443 4042 862 4821 254 1177I want to move the... (3 Replies)
Discussion started by: scigeek
3 Replies

2. Shell Programming and Scripting

Help required

Dear All, I need to script to change TTL of all zone file in my DNS and aslo i require the serial to be updated to reduce my work load. Regards Vicky (0 Replies)
Discussion started by: search4u2003
0 Replies

3. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

4. Shell Programming and Scripting

HELP Required Please!!!!!!!!!

Dear Friends, I have a script below mentioned, it is running OK on Linux platform but somehow now i have to use SOLARIS 10 for this script, When i run this script i have some error messages also given below. Can any of you help me with this, i will be very thankful to him. ... (6 Replies)
Discussion started by: Danish Shakil
6 Replies

5. Linux

Help Required

Hi, please suggest me the possible reasons for application to get hang ???? Thanks and Regards Anand P (1 Reply)
Discussion started by: Anand Prakash
1 Replies

6. UNIX and Linux Applications

Help Required

Hi, please suggest me the possible reasons for application to get hang ???? Thanks and Regards Anand P (0 Replies)
Discussion started by: Anand Prakash
0 Replies

7. Solaris

Help required.

Hi, Iam relatively new to Shell scripting. ............ ......... Cur_log_file=`ls -lrt LOGFILE* | grep 'Jun 30' | tail -1` ............... .................. Iam trying to find some log file name to check their status, using above script line. If the log file is not avaible then rest of... (3 Replies)
Discussion started by: Lokesha
3 Replies

8. UNIX for Dummies Questions & Answers

help required

Hi All, Please help me in the following query need a command to get all the files in the present directory except the next day file format :: abc_<DD>.log $ls -l abc_10.log abc_10.log abc_11.log Now i need the output in abc.list which should contains $more abc.list abc_10.log... (5 Replies)
Discussion started by: thaduka
5 Replies

9. Programming

help required

hi i am new to c programming and found this on the net could someone tell me what it actually does, many thanks in advance cheers #include <fcntl.h> main() { int fd; fd = open("in1", O_RDONLY); printf("%d\n", fd); } and this too please #include <fcntl.h> main() { int... (1 Reply)
Discussion started by: ruffenator
1 Replies
Login or Register to Ask a Question