10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have the following script, and I want to assign the output ($10 and $5) from awk to N and L:
grdinfo data.grd | awk '{print $10,$5}'| read N L
output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
2. Shell Programming and Scripting
I am reasonably capable with awk and its quirks, but not with shell weirdness. This has to be Bourne Shell for portability reasons. I have an awk program that is working just fine; it handles multiple input streams and produces several reports, based on the request (-v Variables). In addition... (3 Replies)
Discussion started by: DerekAsirvadem
3 Replies
3. Shell Programming and Scripting
I would like to have help with syntax for using a string varaibles inside if and else in a awk one liner.
Eg. I would like to say, list all the filenames that have been modified in a particular month(present in a string variable) or list all the filenames whose owner is $owns and owner group is... (3 Replies)
Discussion started by: Prev
3 Replies
4. Shell Programming and Scripting
if a variable has part of awk syntax stored in it. for eg: x=if($1>100)
can we substitute this variable in an awk statement.
based on above requirement can we execute something like:
awk '{x print $1}' infile (5 Replies)
Discussion started by: 47shailesh
5 Replies
5. Shell Programming and Scripting
How do you use a shell variable in awk? I am using Solaris 10 and don't have GNU products installed.
File (transportation.txt) contents:
car
boat
airplane
snowmobile
bicycle
sled
This awk statment works (prints from the car line down to bicycle
awk '/car/,/bicycle/'... (8 Replies)
Discussion started by: thibodc
8 Replies
6. Shell Programming and Scripting
I'm writing a bash script, and I am having trouble with this line:
awk '{print "url = \"http://www.example.com/directory/$type/"$1"\""}' input.file > output.file
Within the URL being printed, I wish the value of the variable "$type" to be printed, after being read from user input from the... (2 Replies)
Discussion started by: meridionaljet
2 Replies
7. Shell Programming and Scripting
Dear All,
we have a command output which looks like :
Total 200 queues in 30000 Kbytes
and we're going to get "200" and "30000" for further process. currently, i'm using :
numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'
my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies
8. Shell Programming and Scripting
line_no=6
echo 'Phone,' `awk 'NR==$line_no{print;exit}' <filename>`
what is the error in this..
it says..
awk: Field $() is not correct.
The input line number is 1. The file is <filename>.
The source line number is 1.
i want to print the data in the $line_no line of a certain... (2 Replies)
Discussion started by: St.Fartatric
2 Replies
9. UNIX for Dummies Questions & Answers
hi there
i write one awk script file in shell programing
the code is related to dd/mm/yy to month, day year format
but i get an error
please can anybody help me out in this problem ??????
i give my code here including error
awk `
# date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies
10. Solaris
There is a possibility to set a variable, having an another variable in it's name:
prompt% setenv PRT one
prompt% setenv VAR_${PRT} value
prompt%
So, this way the VAR_one = "value" and could be viewed:
prompt% echo VAR_one
value
prompt%
Q: How to view a variable having another... (0 Replies)
Discussion started by: alex_5161
0 Replies