problems with a script that outputs data to a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problems with a script that outputs data to a file
# 1  
Old 10-30-2008
problems with a script that outputs data to a file

First of all, im a total newbie to the point that i do not know what are the terms to search for my problem. I did however spend the rest of the day today trying to figure out what is wrong with my bash script. ive always thought that the best way to learn is to tackle a problem heads on. but at the end of this, the only thing i seemed to learn is i suck at this...

basically.. all i want is to create a shell script to grep data from a file and get an output sorted out only with the data i need.

1) grep "consistent expression." $logfile | cut -d"" -f11 > transaction1

2) for file in `cat transaction1` ;do grep ${file} $logfile | grep "/consistent/expression/2" | cut -d"=" -f6 | cut -d"-" -f1,3 | head -1 ; done > transaction2

3) for file in `cat transaction2`; do grep -l "NUMBER ID" ${file}/files/* | cut -d"=" -f2,3 | head -1 ; done > transaction3

4) sed 's/^[ \t]*//;s/[ \t]*$//' transaction3 (to remove spaces)

5) merge transaction1 with transaction3 with echo to indicate what the data means

for e.g

Quote:
transaction1 :

1
2
3


transaction3

A
B
C
becomes

Quote:
ID : 1
Letter : A

ID : 2
Letter : B

ID : 3
Letter : C
any guidance is very much appreciated..

thanks...
# 2  
Old 10-30-2008
Maybe there's a better way to achieve that, post your input file and the desired output.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies

2. Shell Programming and Scripting

Script to check for few conditions and respond with outputs

All, Here is what I am trying to accomplish: 1. Check for a file of specific name recursively and when I find it, a. if the file is more than 1hr old, no need to email or send notification, so just exit out from the shell script b. if the file is less than 1hr old, send an email to me saying... (3 Replies)
Discussion started by: pnara2
3 Replies

3. Red Hat

Problems with EURO symbol in a data flat file

Hi, I'm creating a flat file with various deimiters in Linux RHEL. the content for the flat file will be extracted from an oracle database. delimiters also stored in a seperate table in oracle databasae. when i use extended ASCII characters like cedilla or EURO (€) symbols, the actual character is... (9 Replies)
Discussion started by: Fakru.y
9 Replies

4. Shell Programming and Scripting

Assign specific Color to the outputs in script

Hi, Im programming an interactive menu that verifies the exports of my oracle DB, and im having some trouble finding a process that outputs for example a green command line when the export terminated successfully. i have something like this cat... (15 Replies)
Discussion started by: blacksteel1988
15 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

Execution Problems with scan and change file data content

Input file >Read_1 XXXXXXXXXXSDFXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXAXXXXGXXA . . Desired output file >Read_1 XXXXXXXXXXXXXXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXXXXXXXXXA . . (5 Replies)
Discussion started by: patrick87
5 Replies

7. Shell Programming and Scripting

create outputs from other command outputs

hi friends, The code: i=1 while do filename=`/usr/bin/ls -l| awk '{ print $9}'` echo $filename>>summary.csv #Gives the name of the file stored at column 9 count=`wc -l $filename | awk '{print $1}'` echo $count>>summary.csv #Gives just the count of lines of file "filename" i=`expr... (1 Reply)
Discussion started by: rajsharma
1 Replies

8. Shell Programming and Scripting

expect script, how to deal with different outputs.

I have an expect script that I need to deal with a few different outputs? Here are the commands I am running ssh -o StrictHostKeyChecking=no root@$ipaddress "racadm config -g cfgIpmiLan -o cfgIpmiLanEnable 1" Now, the system I am running this from if I have connected to the server before I... (0 Replies)
Discussion started by: trey85stang
0 Replies

9. Shell Programming and Scripting

Script that takes in variables, and outputs to another text or script file

Ok, I sort of need to create a command files that will be ftped to another server to run. I have some input variable that will need to be read, and then transformed into another script file. Here are some examples. Server 1: outputCmd.sh passing in ./outputCmd.sh nh8oaxt Release_4_0... (1 Reply)
Discussion started by: orozcom
1 Replies

10. Shell Programming and Scripting

How to store the outputs of a shell script inside a log file???

My shell script file name is test.sh and the contents of this test.sh file are ps_file="package1.ps" echo $ps_file ps_file1=`echo $ps_file| sed "s/.ps//g"` echo $ps_file1 ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file1.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file1.pdf Now i... (2 Replies)
Discussion started by: sunitachoudhury
2 Replies
Login or Register to Ask a Question