Sponsored Content
Full Discussion: Scripting job to complete
Top Forums Shell Programming and Scripting Scripting job to complete Post 302514833 by palanisvr on Monday 18th of April 2011 08:34:14 AM
Old 04-18-2011
Try the new updated one.

hope this should fix your issue , as there are lot of white space between the field values I have hard coded the columns to replace with null so change accordingly as per your request if you want to add new columns in the output list , output will be saved in Output.txt.


Code:
#!/bin/ksh

sed 's/^[ \t]*//' cdr.txt > cdr_1.txt
sed '/^$/d' cdr_1.txt > cdr_2.txt
sed -e 's/^[ \t]*//' cdr.txt -e '/^$/d' cdr_1.txt > cdr_2.txt
for i in `grep -n "CDR" cdr_2.txt |awk -F ':' '{print $1}'`
do
i=`expr $i + 2`
idx=`expr $i + 25`

a=`sed -n "$i","$idx"p cdr_2.txt|sed -e s/recordType// -e s/servedIMSI// -e  s/ggsnAddress// -e s/chargingID//  -e s/sgsnAddress//  -e s/accessPointNameNI// -e s/pdpType//  -e s/servedPDPAddress// -e  s/dynamicAddressFlag// -e s/listOfTrafficVolumes//  -e s/qosNegotiated// -e s/Length// -e s/"Alloc.\/Retention priority"// -e s/"Delay class"// -e s/"Reliability class"// -e  s/"Peak throughput"// -e s/"Precedence class"// -e s/"Mean throughput"// -e  s/"Traffic class"// -e  s/"Delivery order"//  -e s/"Delivery of erroneous SDU"// -e s/"Maximum SDU size"// -e s/"Max bit rate for uplink"// -e  s/"Max bit rate for downlink"//  -e s/"Residual BER"// -e s/"SDU error ratio"// |sed 's/^[ \t]*/\|/'|tr "\n" " "` 

if [ ! -z "$a" ]
then
len=`expr length "$a"`
a=`expr substr "$a"  2 $len`
echo $a >>Output.txt
fi

done

This User Gave Thanks to palanisvr For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

start job after complete transfer....

Hi, I have a situation... I have a script it checks for a file in a folder which comes to the folder every day at specified time...2am to 4 am, once the file is in the polder my process starts...but the problem is the files being placed are huge and it is even taking half an hour for the file... (3 Replies)
Discussion started by: mgirinath
3 Replies

2. Windows & DOS: Issues & Discussions

windows scripting for a batch job

I have been doing unix scripting for quite awhile and there seems to be a wealth of information on it. Now I am working on migrating an intel based application to a new server. I need to modify some existing scripts, but am having trouble finding information on windows scripting, a forum similar... (2 Replies)
Discussion started by: MizzGail
2 Replies

3. UNIX for Advanced & Expert Users

At job in SHELL SCRIPTING

Hi I am using at job in my SHELL scripts.. When it prompts to enter the time for at job..I used to press enter(return) button.. After that its running the job properly, but its showing the below error UX:at: ERROR: Bad date specification.. Can some one suggest how to remove that error. ... (2 Replies)
Discussion started by: grajesh_955
2 Replies

4. Shell Programming and Scripting

How to schedule a job in shell scripting.

Hi all I have made a shell script to check jobs' status and send an alert based on the result. I want to run this script to run every 4 hours and I don't have access to cron. Can we schedule using shell scripting instead of cron facility? (2 Replies)
Discussion started by: johnl
2 Replies

5. Post Here to Contact Site Administrators and Moderators

Where can I download the VTC - Unix Shell Scripting Advanced complete video

Where can I download the VTC - Unix Shell Scripting Advanced complete video. I don't know in which thread I should post this question.Plz help me out, or just tell me the link in the reply to this post. Thanks in advance. (0 Replies)
Discussion started by: villain41
0 Replies

6. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

7. Windows & DOS: Issues & Discussions

AutoSys Job not waiting for script to complete

I'm not sure if this is the right place to post this issue...but here goes... I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies

8. Shell Programming and Scripting

I want a script to view the complete log information of data stage job from UNIX IBM AIX.

Hi, I am working on data stage 8.7 version and I want a script a to view the all log information of the data stage job from UNIX environment. Can you please help me out by give the script. Thanks in advance... (7 Replies)
Discussion started by: victory
7 Replies

9. Shell Programming and Scripting

To refire a backup job using shell scripting..........

how to write a code using shell scripting to refire a back up job if it fails with an error code of 196? (7 Replies)
Discussion started by: Pawan Ramnani
7 Replies

10. UNIX for Beginners Questions & Answers

Automation script for email alert when a job get complete with status successful.

Guyz, Please let me know about script which is to be sending an automatic email to particular mail id's when a monotoring job get complete with status successful. (1 Reply)
Discussion started by: Rehan Ahmad
1 Replies
proto(4)						     Kernel Interfaces Manual							  proto(4)

NAME
proto - prototype job file for at SYNOPSIS
DESCRIPTION
When a job is submitted to or the job is constructed as a POSIX shell script (see at(1)). The job file is created in as follows: o creates a header describing the job as an job or a job. jobs submitted to all queues other than queue are listed as jobs. The header is: for an job, or for a job. o A set of POSIX shell commands is added to make the environment (see environ(5)) for the job the same as the current environment. o then copies text from the prototype file to the job file, except for special variables that are replaced by other text: Replaced by the current working directory. Replaced by the current file size limit (see ulimit(2)). Replaced by the current umask (see umask(2)). Replaced by the time at which the job should be run, expressed as seconds since January 1, 1970, 00:00 Coordinated Universal Time, preceded by a colon. Replaced by text read by from the standard input (that is, the commands provided to to be run in the job). o When a job is submitted to queue queue, uses the file as the prototype file if it exists. Otherwise, it uses the file EXAMPLES
The following file creates commands to change the current directory, file size limit, and umask in the job to their respective values as they existed when was originally run. These commands are inserted before the commands in the job: SEE ALSO
at(1), queuedefs(4). STANDARDS CONFORMANCE
proto(4)
All times are GMT -4. The time now is 02:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy