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)
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)
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)
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)
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)
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)
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)
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)