Script not working as desired


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script not working as desired
# 29  
Old 07-28-2006
I can't see any parenthesis mismatches there. Can you go through the code ( as you have copied it and ensure that everywhere I have used a '(' or ')' you also have one of the same type and the same for '{' and '}'
# 30  
Old 08-17-2006
Please Read REBORG

Reborg,

Sorry I haven't been able to get back to you till now. The code is working fine but there is a problem with the file i am receiving. It's having more than 50 fields each seperated by "|" as delimiter and hence it's going into next line also. I mean a record is occupying more than 2 to 3 lines. In that case script is not working as desired as it just checks the number of lines and not records.
for e.g. the record in the file looks like

Quote:
date|sql|count|bytes|ye|month|colu|fig|.......
20060708|sel abc from ..........................................................................|2|100|2006|8|3|2
Please provide help so that script works for this scenario also.

Please help.
# 31  
Old 08-18-2006
Can any one help with this script? It hapeens that I am also having similar situation.
# 32  
Old 08-22-2006
Data Please help!!! Critical situation

Reborg,

I don't know whether you got a chance to look at the problem or not. Each record in the file is having around 50 fields and each of them seperated by "|". So because of this the records are occupying 2 to 3 lines. In the script we count each line as a record by the statment

Quote:
data[NR] = $0
How should i make the code read the entire record instead of depending on line itself. Please help man. This is very urgent for me.
# 33  
Old 08-22-2006
pls post a sample file and identify your 'records'.

what makes the 'record' occupy multiple lines?

how do you identify a complete record?
# 34  
Old 08-22-2006
Vgersh,

I am having the same problem and I am also using this script. Please see below for the file layout and one sample data row that extends more than 1 line.

Quote:
Header:
BAN | BILL_SEQ_NO | SUBSCRIBER_NO | SOC | AIRTIME_FEATURE_CD | BASE_RECORD_IND | RATE_GROUP | RECORD_TYPE | DEF_UNIT_MEASUR_CD | UNIT_MEASURE_CODE | CTN_VOLUME | CTN_VOL_NO_AIR | CTN_IV_USED_PRD_1 | CTN_IV_USED_PRD_2 | CTN_IV_USED_PRD_3 | CTN_IV_USED_PRD_4 | CTN_IV_USED_PRD_5 | CTN_IV_USED_PRD_6 | CTN_VOLUME_PRD_1 | CTN_VOLUME_PRD_2 | CTN_VOLUME_PRD_3 | CTN_VOLUME_PRD_4 | CTN_VOLUME_PRD_5 | CTN_ VOLUME_PRD_6 | CTN_MINS | CTN_MINS_NO_AIR | CTN_IM_USED_PRD_1 | CTN_IM_USED_PRD_2 | CTN_IM_USED_PRD_3 | CTN_IM_USED_PRD_4 | CTN_IM_USED_PRD_5 | CTN_IM_USED_PRD_6 | CTN_FM_USED_PRD_1 | CTN_FM_USED_PRD_2 | CTN_FM_USED_PRD_3 | CTN_FM_USED_PRD_4 | CTN_FM_USED_PRD_5 | CTN_FM_USED_PRD_6 | FREE_MIN_USED_PRD_1 | FREE_MIN_USED_PRD_2 | FREE_MIN_USED_PRD_3 | FREE_MIN_USED_PRD_4 | FREE_MIN_USED_PRD_5 | FREE_MIN_USED_PRD_6 | CTN_MINS_PRD_1 | CTN_MINS_PRD_2 | CTN_MINS_PRD_3 | CTN_MINS_PRD_4 | CTN_MINS_PRD_5 | CTN_MINS_PRD_6 | SYS_CREATION_DATE | SYS_UPDATE_DATE
Data row:
Quote:
1234|4567980|234587995|321345676|yaar|y|n|y|456|457|567|123456789|567890|213|234|567|56789086|567890 765|5678435|12342|879076|56789|5643|56789|67212325568789|7890765|yu|3456|ee4t5676|434556|6789|56789| 56789|67890|5r67688|6767879|567687|57679789|6576879|57677878998|5434|4656776|46567567|46576|456568|3 545652|23|456|20060721 08:09:30|20060804 23:54:54
2345|345677|34434565|35345456|nope|n|y|y|243555|4456567|............................................ ...............
Please see that the 2nd data row is represented with dots(....) and the 1st record in bold
# 35  
Old 08-22-2006
Critical situation

Sravan,

Thanks Sravan for your reply.

Vgersh/Reborg,

Did you get a chance to look at it? Please help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need comand or script for append text after searching for the desired string

Hi all, i have a generated report in unix in the following command like input.txt 47.85,10 0124,42.35,8 0125,3.5,2 the input file format is fixed I need the my output file with append text as below output.txt 0124 amount:42.35 0125 amount:3.5 0124 count : 8 0125... (34 Replies)
Discussion started by: hemanthsaikumar
34 Replies

2. Shell Programming and Scripting

Needed shell script to append desired text to each line in a file

Hi, I had generated a report in my tool as followsoutput.txt 43.35 9 i needed the script to generate a new file like below i want to append the text to each of these lines of my filenewoutputfile.txt should be Total Amount : 43.35 Record Count:9 Regards, Vasa Saikumar. ... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

3. Emergency UNIX and Linux Support

Script to fill the file system mount with empty files to desired size

We are regularly using for our testing, where we are manually filling up the mount with desired size with following command dd if=/dev/zero of=file_2GB bs=2048000 count=2000 We are planning to automate the task where taking input for % of size as one input and the name of the file system... (8 Replies)
Discussion started by: chandu123
8 Replies

4. 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

5. Shell Programming and Scripting

Cron job is not working in the desired manner on IBM AIX

Hi, I have created a cron job on IBM AIX but it is not working in desired manner ! Here are the steps which I have followed :- #!/bin/ksh #------------------------------------------------------------------ find /some/file/at/the/user/side/test.log -exec cp {}... (8 Replies)
Discussion started by: acidburn_007
8 Replies

6. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

7. UNIX for Dummies Questions & Answers

if statement not working as desired

Hello all, I am trying to write a post-commit hook script using bash script. What I am trying to do here is: Developers check in their files to a branch. I check the repository and based on the commit I email QA people. QA verifies and moves the files to a prod branch and email is sent... (1 Reply)
Discussion started by: kminkeller
1 Replies

8. Shell Programming and Scripting

C shell integer tests, less than and more than, not working as desired

Hello, I am creating a script that gives me system load info when i start a shell or log in via ssh(in the /etc/profile.d/ folder). I created it successfully for bash and want it to work with c-shell as well. This is where i'm having problems, the integer test in the if sentence does not work... (3 Replies)
Discussion started by: str1fe
3 Replies

9. Shell Programming and Scripting

script not giving the desired output

Hi, I have a script in which an entry like this ..... FILENAME_B="PIC_${DATE}0732*.JPG" The script connects to an ATM and pull a pic file from it.The format for the file is like PIC_2008061400000001.JPG in the ATM. Means 1st 8 digit is the date(YYYYMMDD) field 2nd 8 digit means hrs... (2 Replies)
Discussion started by: Renjesh
2 Replies

10. UNIX for Dummies Questions & Answers

chmod not working as desired

my file had permission -rw-rw-r-- I did chmod +rwx, expecting everything to now be rwx, but it is -rwxrwxr-x why doesn't o have x permission? thanks. (2 Replies)
Discussion started by: JamesByars
2 Replies
Login or Register to Ask a Question