getline from another file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting getline from another file
# 8  
Old 10-14-2011
I have tried sytem function of awk,
But it can only output the return value of system.

here is the sample of output:I put it in code for readablity .
Code:
0x00009f7c       9    0    0    0     SliceData          No          No      40  1317630108771
0x00009f85    2976    0    0    0     SliceData          No          No      40  1317630108771
0x0000b116       9    0    0    0     SliceData          No          No      44              0    
0x0000b11f    2972    0    0    0     SliceData          No          No      44              0 
0x0000c236       9    0    0    0     SliceData          No          No      48              0    
0x0000c23f    2568    0    0    0     SliceData          No          No      48              0
0x0000d10b       9    0    0    0     SliceData          No          No      52              0    
0x0000d114    2411    0    0    0     SliceData          No          No      52              0
...
0x0003ea6a       9    0    0    0     SliceData          No          No     348              0
0x0003ea73    1025    0    0    0     SliceData          No          No     348              0
0x0003f006       9    0    0    0     SliceData          No          No     352  1317630119121
0x0003f00f     977    0    0    0     SliceData          No          No     352  1317630119121


Last edited by lzq420241; 10-14-2011 at 02:23 PM..
# 9  
Old 10-14-2011
awk is more powerful than sed all by itself, and capable of reading external files all by itself.

There's certainly a way to do what you want in awk alone if we can just figure out what you actually want.

Could you post a sample of what the output should be for some given input?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk with if, getline, and another if

Howdy Folks, It seems like it is always awk that confuses the heck out of me and I even have books and examples. I have this line: awk '{if (/clientIP/)(SRV = $NF); if ($2 ~ /BUNDLE-GIM/) getline; if ($2 ~ /r100595/) {print SRV,"BUNDLE-GIM",$2}}' post.txt to parse this text: <api... (4 Replies)
Discussion started by: port43
4 Replies

2. Shell Programming and Scripting

awk getline t file

I want to import a textfile with getline into var t which has several lines. How do import all lines, since it only imports the last line: while < ((getline t "textfile") > 0) (7 Replies)
Discussion started by: sdf
7 Replies

3. Shell Programming and Scripting

GetLine fn always giving last line of the file

Hi, Its bit urget for me to complete. pls help me. I am parsing 2 file 1. INDATA(Data file) 2. GRPFIL(Reference) every record in INDATA should be verified with GRP_DATA. I am seeing the output from only the last line of ref file, its not searching all the lines. INDATA sample... (1 Reply)
Discussion started by: hyperion.krish
1 Replies

4. Shell Programming and Scripting

awk print header as text from separate file with getline

I would like to print the output beginning with a header from a seperate file like this: awk 'BEGIN{FS="_";print ((getline < "header.txt")>0)} { if (! ($0 ~ /EL/ ) print }" input.txtWhat am i doing wrong? (4 Replies)
Discussion started by: sdf
4 Replies

5. Programming

getline()

I can not get 'getline()' to compile. I have tried. string curLine; //= compiler error char* curLine; //=compiler error char curLine; //=compiler error Every example I see uses a string as a getline(); parameter. It does not work for me on Fedora14 with gcc-c++. Thank you so much. This... (1 Reply)
Discussion started by: sepoto
1 Replies

6. Shell Programming and Scripting

awk - getline from parametric file name

Hi! I have an input file for an awk script that I need to split into several files and the process them separately line by line. I have splitted the input file into the other files, that have been created correctly. But, since their names are parametric (i.e. output_1.txt, output_2.txt..... (2 Replies)
Discussion started by: Alice236
2 Replies

7. Shell Programming and Scripting

Some Awk Getline help?

Greetings, I have about 3000 files that I want to search. The first column in all of these 3000 files has a unique serial number on each line. The subsequent columns have lots of data. I have another masterfile with three columns to help me find all the data I need in a moments notice: col 1... (15 Replies)
Discussion started by: jeeplou
15 Replies

8. Programming

'getline' questions

I have a C program I've written that includes a 'getline' call that is used to read a line at a time from a file and process the information in each line. A potential problem comes up since I don't know the maximum length of each line; right now I'm using a constant of 256, but that might not be... (2 Replies)
Discussion started by: cleopard
2 Replies

9. Shell Programming and Scripting

acessing awk array element while getline < "file"

I am attempting to write a awk script that reads in a file after awk array elements are assigned and using those elements while reading in the new file. Does this make sense? /pattern/ {tst=$3} (( getline < "file" ) > 0 ) { x=x " "tst } When I print tst in the END statement it... (9 Replies)
Discussion started by: timj123
9 Replies

10. Shell Programming and Scripting

using the getline to populate an array from a file

Hello, I am trying to use the awk getline command to populate an array from a flat file. Has anyone done this before? So we have file1: a b c d I want to create an array like index that contains these four elements (8 Replies)
Discussion started by: penfold
8 Replies
Login or Register to Ask a Question