As you can see from my script above, I run some awk commands on this file called "final" to extract the data i need.. there are 7 columns in total in the file seperated by a comma.
1) My first line of awk looks at the 5th and 6th column for the words AUTH CODE and a three letter code 000, 100, or 001 respectivly and then extracts to a file called finaltemp
2) The next line, checks to see if the 4th column is indeed 14 characters, if not then chucks it to an exceptions file , it then creates a file called WSECTRAD with all records that ok
3) The next awk extracts column 6 values of 055, 002 and 003 to another exceptions file
4) And finally another awk looking at column 5 for some keywords, again throwing them out to an exceptions file
Now that all seesm to work great, except strangely on a couple of occasions where a single 003 (in the 6th column) seems to make its way into the WSECTRAD file AND the exceptions file ?!? ....I can obviously understand why it goes to exceptions, because a 003 is an exception.....but why does this one rogue entry end up in WSECTRAD ??
As you can see from the section of the "final" file at the top,(its the second one from the top) it is not the only 003 at all, infact there are loads of these throughout the file, and unless I am going blind, I cant see the difference between this record and any of the other 003's (as far as the awk scripts are concerned anyway)
Can anybody spot any reasoning why this one record is the only 003 to hit the WSECTRAD file ??? (as mentioned before, A copy does also go to the correct exceptions file aswell)
The reason it was bringing in the record with "003" in it was because the end of the 5th field for that record ended in "1". When you concatenate the two fields with $5$6, you end up with "1003" at the end of $5$6 which matches the rule you defined in the first awk. Therefore, you need the "$" at the end of the regex to tell it that the (000|001|100) is anchored at the very end of the fields in the match.
I am having a problem. which I have described below>>
I have to run a script with the format : <File_name><Start_date><End_date>
abcd.sh 19-JAN-2015 01-May-2014
problem is I need to compare these two dates and throw an error as start date must be less than or equal to end date.
But... (13 Replies)
Greetings all,
Disclaimer: I'm a novice and always welcome best practices as I'm learning.
File example:
100,1.1.1.1,1.1.1.2,10.10.10.1,172.16.1.10,172.16.1.20
101,1.1.2.1,1.1.2.2,10.10.20.1,172.16.2.10,172.16.2.20
102,1.1.3.1,1.1.3.2,10.10.30.1,172.16.3.10,172.16.3.20
...and so on
... (3 Replies)
needing this script to shut down 1 IceS and start up another, close the 2nd one after 12 seconds and then reboot. here is what i have so far
#!/bin/bash
ShutDown() {
echo "Shutdown in progress."
wall <<ENDOFWALL
CI Shutdown has been intiated!!!!
Shutdown will occur in 30 seconds...... (1 Reply)
I am having an issue with a script that I created today, my first attempt at this, and was wondering if anyone can give me insight to what changes need to be made. Below is a copy of the script that I have written. WEe are trying to monitor whether or not a services is running. I do have a cron... (1 Reply)
hi guys,
I am quite a newbie to Linux.I have an issue.Please help me;
I have to create a script that runs "ls -la" inside a directory Bong and then I need to run the command through awk and have the output as follows:
Filename: abc.txt
Owner: test1
Group: test2
Permissions:... (1 Reply)
Hello,
I have an ASCII file (many files of the same format, but different dates and numbers) in the format like below:
2008.01.02,08:00,1.46520,1.46520,1.46410,1.46440,70
2008.01.02,08:05,1.46450,1.46560,1.46440,1.46540,79
2008.01.02,08:10,1.46530,1.46540,1.46490,1.46500,46... (8 Replies)
Hello,
Guys I am having a sql script file which contains some sql statements including inserting values, One column is of the data type date.
Now i am having a KSH script for inserting values via this script into the database.
The problem I am facing that when I am inserting value in the... (1 Reply)
Hi Guys,
I am quite new to Shell Scripting... I need ur help.. This is very urgent.
The thing is like,
I need to match a IP address (ex 192.168.200.56) i.e, xxx.xxx.xxx.xx inside a KSH script,but if we enter in different format other than the specified format (ex jjj.ksj., 1.0...), it should... (3 Replies)
Hi guys...
I am a newbie to scripting... I have a small requirement... I dont whether u r clear with my requirement... But plz try to help me...
Like,
tell me some kind of scripts that can help me in retreiving the data from the datasets.
Regards,
Mahesh... (1 Reply)
folks;
i'm trying to write a shell script to do the following:
1. i have a file with 39 fields, i'm trying to add 10 more fields with (!) as a field separator. with the following requirement:
if field number 20 has a value, then field number 40 will show as (!M!), and if the field number 20 does... (2 Replies)