Formatting Report and Reading data and fetching the details from contents file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Formatting Report and Reading data and fetching the details from contents file
# 1  
Old 04-26-2012
Formatting Report and Reading data and fetching the details from contents file

Data
Quote:
mainksh.ksh
#/usr/ksh
[step1]="$RUN_DIR/calling1.ksh"
[step2]="$RUN_DIR/calling2.ksh" "$SUB_DIR/sub/v1/calling21.ksh"
"$RUN_DIR/calling3.ksh"

calling1.ksh
"$RUN_DIR/$SUB_DIR/calling101.ksh"

calling101.ksh
"$RUN_DIR/$SUB_DIR/calling1011.ksh"
I was trying to write shell script which will be return the output in the below format

Quote:
mainksh.ksh /usr/local/ramesh/run/calling1.ksh
mainksh.ksh /usr/local/ramesh/run/calling1.ksh /usr/local/ramesh/run/cfg/calling101.ksh
mainksh.ksh /usr/local/ramesh/run/calling1.ksh /usr/local/ramesh/run/cfg/calling101.ksh /usr/local/ramesh/run/cfg/calling1011.ksh
mainksh.ksh /usr/local/ramesh/run/calling2.ksh (/usr/local/ramesh/run/calling21.ksh)
mainksh.ksh /usr/local/ramesh/run/calling3.ksh
First i was trying to do these using sed.
Code:
sed -n '/.ksh/p' mainksh.ksh
sed -e 's/[^"]*\(.*\)/\1/g' mainksh.ksh

$RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file.

when i am trying to use the below command by merging above 2 commands, it is printing the values twice and even it is printing #/usr/ksh line
Code:
sed -n -e '/.ksh/p; s/[^"]*\(.*\)/\1/g' mainksh.ksh


Last edited by rameshds; 05-02-2012 at 08:38 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. UNIX for Beginners Questions & Answers

Fetching address and user details from log file

Hi All, I have a requirement to get the address values from a large log file along with the user details. line1,line2,city,stateCode,postalCode,countryCode. The below code as advised in the earlier post is giving the user data zgrep -B1 "Failed to calculate Tax" log.2018-05-23.gz | grep... (8 Replies)
Discussion started by: nextStep
8 Replies

3. Shell Programming and Scripting

Fetching data particular data from the file.

Hi All, I have one fine which contaning the record as below, I need to fetch the number which is in Bold and from second line only URL need to pick. :ABCD C7QyzBXIs58k 1 fdmlksdlkfn ... (4 Replies)
Discussion started by: Riverstone
4 Replies

4. Shell Programming and Scripting

Fetching data from file

Hi All, I'm facing issue while using script. Chk_Etl_Status=`cat /dstage/questnet/qnetdv/input/Etl_Status.dat|cut -d"," -f1` echo Chk_Etl_Status=$Chk_Etl_Status above result is giving me sometime value as 1 and sometime error message as Chk_Etl_Status= dsjoblaunch.sh: test: Specify a... (5 Replies)
Discussion started by: Amit786
5 Replies

5. Shell Programming and Scripting

Reading the contents of the file and splitting using ksh

We're using a ksh script for installing one product. I've another config file, I'd need to read this configuration file from my main script Content of the Configuration file:... (2 Replies)
Discussion started by: bittu129
2 Replies

6. UNIX for Dummies Questions & Answers

Looping/Reading file contents not working

Hi, I am doing something basic, but I am missing something. Im trying to read the contents of a file and taking those values and connecting to a database. However, it only connect to one (or reads in) value and then exists. Here is what it looks like: listname.txt db1 db2 db3 Script:... (15 Replies)
Discussion started by: DBnixUser
15 Replies

7. Shell Programming and Scripting

Reading file contents until a keyword

Hi Guys, I need to read a file until I find a blank line. and in the next iteration I want to continue reading from the line I find a keyword. For ex: my file looks like PDS_JOB_ALIAS CRITERIA_ITEM_TYPE PDS_JOB_CRITERIA_ITEM CRITERIA_ITEM_TYPE First I want to read the file... (2 Replies)
Discussion started by: infintenumbers
2 Replies

8. Shell Programming and Scripting

Fetching data from .csv file

Hi Experts, I have created a table with columns as empname,empid,phone,shiftname. Now I am having a .csv file format which contains the shift datas of the employees. I have to fetch this file and compare with the table I created to send an alert to the specified user. (2 Replies)
Discussion started by: micky3112
2 Replies

9. Shell Programming and Scripting

Reading files under a folder and formatting content of each file

I have 'n' number of files in a folder .each file in the folder "myfolder" is having the content like. COLNAME ------------ AAAAAA BBBBBB CCCCCC DDDDDD ... ... ... ZZZZZZ 26 recrod(s) selected. My request is by reading each file in "myfolder" and format each file such a way... (18 Replies)
Discussion started by: rocking77
18 Replies

10. Shell Programming and Scripting

Reading and printing one by one contents of a file

I have a file which has following contents: localhost_IP_SIP_1233026552455.xml localhost_IP_SIP_1233026552460.xml localhost_IP_SIP_1233026552467.xml localhost_IP_SIP_1233026552759.xml localhost_IP_SIP_1233026552969.xml localhost_IP_SIP_1233026552975.xml ... (2 Replies)
Discussion started by: Aditya.Gurgaon
2 Replies
Login or Register to Ask a Question