NAWK Script not working fine


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting NAWK Script not working fine
# 1  
Old 06-06-2008
Error NAWK Script not working fine

Hello to all

can any one help me out with a nawk script.
Actually i am having a shell script which uses nawk pattern searching
and it is not parsing the file properly.
I have been debugging it since long time, but nt able 2 find the root cause..

If any one can help me out with this one ..
# 2  
Old 06-06-2008
Yes, there are plenty helpful people here.

What does the script, the input and the deserved ouput look like?
# 3  
Old 06-09-2008
Thanks for your reply,

Input file looks like a report like this
Currency: JPY
SOBP=xxx (JAPAN)
ORG ACCT PR SOB PTD LOCAL
--------- ---- -- ---
Hardware
801140xxx 51 801 3,999,638.00
Software
80x140xxx 31 801 648,000.00
80x140xxx 31 801 1,596,400.00
80x140xxx 51 801 818,922.00
80x140xxx 31 801 121,415.00


And output file looks like

xx|106|07-07|1120xxxxx|112|S/W|02|USD| xxxxxx|1043|0x/1x/200x
xx|106|07-07|1120xxxxx|112|S/W|51|USD| xxxxxx|1043|0x/1x/200x

basically, input file is parsed to generate pipe delimited file which contains the information from input file.

What is happening here is, the no. of records does not equals the records in input file.

and also some special characters gets inserted in output file..
# 4  
Old 06-12-2008
I really appretiate the people visited to this thread, but I would be glad do if the person visiting to this thread leave some comments or suggestions to this issue..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

--SunOS 5.10 nawk for paragraph not working

The machine is using bash: ================== bash -version GNU bash, version 3.2.51(1)-release (i386-pc-solaris2.10) Copyright (C) 2007 Free Software Foundation, Inc. ========================= I have the following xml file. am trying to get a whole paragraph if it meets certain criteria.... (9 Replies)
Discussion started by: gilgamesh
9 Replies

2. Shell Programming and Scripting

Nawk command not working for Question mark (?)

Hi Folks, I am facing an issue with nawk command. The data is as below: ABC0022,BASC,Scene Package,INR,02May17,XXX4266,be?. Hotel,3,AW01,Twin Room,61272,41308,39590,39590,X,X ABC0022,BASC,Scene Package,INR,02May17,XXX4266,be?. Hotel,3,AW02,Twin Room with Balcony,9272,85638,4520,9590,X,X... (1 Reply)
Discussion started by: kirans.229
1 Replies

3. Shell Programming and Scripting

sed command not working inside ksh script but works fine outside

Hi, I am a bit confused ,why would a sed command work fine outside of ksh script but not inside. e.g I want to replace all the characters which end with a value and have space at end of it. so my command for it is : sed -i "s/$SEPARATOR /$SEPARATOR/g" file_name This is working fine in... (8 Replies)
Discussion started by: vital_parsley
8 Replies

4. Shell Programming and Scripting

Getting Command not found error Even though Script is working fine

Hi friends, I am using below script to do some work. But even though script is working fine but while executing it i am getting command not found error. :( Here is the script :- #!/bin/sh Names="name.txt" ###main##### for LINE in `cat ${Names}` do ... (3 Replies)
Discussion started by: harpal singh
3 Replies

5. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

6. Shell Programming and Scripting

Sed script not working properly on Solaris (works fine on AIX)?

Hi, I have a problem with a SED script that works fine on AIX but does not work properly on a Solaris system. The ksh script executes the SED and puts the output in HTML in tables. But the layout of the output in HTML is not shown correctly(no tables, no color). Can anyone tell if there is... (7 Replies)
Discussion started by: Faith111
7 Replies

7. Shell Programming and Scripting

Getting issue while running it from cron while manually working fine

Hello, I am working one one script where I am using the below code which is using to connect with MKS client when I run my script manually it works effiecently i.e. it connects with MKS client but when I run it from CRON it doesn't connect. 1)Can some one tell when it is running from cron... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

8. Shell Programming and Scripting

Nawk Script not working

Any idea why this isn't working? YESTERF=`TZ=aaa24 date +%b"-"%d | sed 's/-0/--/'` filelist2=$(find /export/home/gen/cks/traces \( -name \*YESTERF\* -name \*DNA\* \) -print | tr '\n' ' ') print "Date/Time,Location,Shelf,IP,Reason,Log Filename" >> $OUTPUT nawk -F':' ' $2 ~... (2 Replies)
Discussion started by: ther2000
2 Replies

9. Solaris

GUI not working... CLI is working fine

Hello, I have X4500 running Solaris 10. I can access it through CLI but I cannot see the GUI. When I reboot it, the GUI works till all the files are loaded (ie., the initial boot sequence) and it prompts me to enter username and password and there it ends. The screen just has a blinking cursor... (4 Replies)
Discussion started by: bharu_sri
4 Replies

10. UNIX for Advanced & Expert Users

How to know whether my perodic thread is working fine

Dear All, I am using xenomai-2.4 along with linux kernel 2.6 In my application having following threads. 8ms perodic thread (RT TASK) 1ms perodic thread(RT TASK) 16ms perodic thread(RT TASK) 256ms perodic thread(RT TASK) 22 - pthread are condition based it may execute or else in... (1 Reply)
Discussion started by: rajamohan
1 Replies
Login or Register to Ask a Question