02-07-2005
sorry about that.
If you do have nawk - I would use the original solution for nawk.
awk '
BEGIN {
cmd="read a; echo $a"
}
{
print "-> "$0
printf "Enter response :"
cmd | getline var1
close(cmd)
print "-- " var1 "$0 : " $0
} ' ./essai.lst
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
can any one please help me how to use "read" command for openig a file.i want to process the file record by record and then needs to search for a particular string at a particular position.can any one please let me know the code.i am new to the shell.
below are sample sample records
... (3 Replies)
Discussion started by: raoscb
3 Replies
2. Shell Programming and Scripting
Hi ,
I have a piece of code ...wherein I need to assign the following ...
1) A command line argument to a variable
e.g origCount=ARGV
2) A unix command to a variable
e.g result=`wc -l testFile.txt`
in my awk shell script
When I do this :
print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies
3. Shell Programming and Scripting
I need some advice, I have live feed containing xml messages which means there is new messages every minute. I need a script that will run every 2 hours using the current time minus 2 hours ( which I able to do) However I have problem with the date formatting i.e.
One date is... (3 Replies)
Discussion started by: INHF
3 Replies
4. UNIX for Dummies Questions & Answers
Hello,
Below, I have a unix command, which can be executable for single file.
cat input.txt | sort -k3,3 > output.txt
I have 100 input files in a directory. It is hectic and time taking to run the above command for all the 100 files for 100 times.
Now, I want to execute the above unix... (2 Replies)
Discussion started by: koneru_18
2 Replies
5. Shell Programming and Scripting
Hello,
Am trying to print three lines in a single line using AWK getline command.
Below is the command am trying and its displaying only two lines in a single line.
Command:
awk '{getline n; printf($0,t);next}'
Can you please help me ?
Thanks,
Prince (1 Reply)
Discussion started by: prince1987
1 Replies
6. Shell Programming and Scripting
Tested on : bash
Will be implementing on : ksh
I dont know if this is weird , or my idea of Unix stdin or stdout is completely messed up , but if I use the following command, I am getting a proper output.
ls -l | head -1 | while read a ; do echo $a ;done
and the output is soemthing like... (5 Replies)
Discussion started by: kumarjt
5 Replies
7. Shell Programming and Scripting
Hi,
Can you please help me to find/display out last Friday's date of the month using awk command in Unix/Linux.
i have found this command
cal 03 2013 | awk 'NF>5{last = $6} END{print last}'
it show the output in single digit date like :29
But i need its output will shown in Fri Mar... (20 Replies)
Discussion started by: avig
20 Replies
8. Shell Programming and Scripting
Hello, I have a file that looks like this:
Generated geometry (...some special descriptor)
1 0.56784 1.45783 -0.87965
8 1.29873 -0.8767 1.098789
... ... ... ...
Generated geometry (....come special descriptor)
... .... ... ...
... ... ... ...
and... (4 Replies)
Discussion started by: jaldo0805
4 Replies
9. Shell Programming and Scripting
Hi All,
Do we know how to read input file within awk script and send output toanother log file. All this needs to be in awk script, not in command line. I am running this awk through crontab.
Cat my.awk
#!/bin/awk -f
function test(var){
some code}
{
}
END
{
print"test code"
} (5 Replies)
Discussion started by: random_thoughts
5 Replies
10. Shell Programming and Scripting
Input are file and file1
file contains
store.bal
product.bal
category.bal
admin.bal
file1 contains
flip.store.bal ::FFFF:BADC:CD28,::FFFF:558E:11C5,6,8,2,1,::FFFF:81C8:CA8B,::FFFF:BADC:CD28,1,0,0,0,::FFFF:81C8:11C5,2,1,0,0,::FFFF:81DC:3111,1,0,1,0
store.bal.... (2 Replies)
Discussion started by: veeruasu
2 Replies