10-12-2012
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file with the following content.
> cat /tmp/internetusage.txt
6709.296322 30000 2/7/2010 0.00I am using the following awk command to calculate a percentage from field 1 and 2 from the file.
awk '{ print $1/$2*100 }' /tmp/internetusage.txt
This outputs the value "22.3643" as a... (1 Reply)
Discussion started by: jelloir
1 Replies
2. Shell Programming and Scripting
With this script i want to print the output to a specific field-number . Can anybody help?
awk 'NR=FNR{split(FILENAME,fn,"_");nr=$2;f = $1} END{for (i=1;i<=f;i++) print i,$fn=nr}' input_5.csv input_6.csvinput_5.csv
4 135
5 185
6 85
11 30input_6.csv
1 90
3 58
4 135
7 60
8 55
10... (1 Reply)
Discussion started by: sdf
1 Replies
3. Shell Programming and Scripting
Hi All,
I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file.
Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies
4. Shell Programming and Scripting
I would like to print the number of records of 2 files, and divide the two numbers
awk '{print NR}' file1 > output1
awk '{print NR}' file2 > output2
paste output1 output2 > output
awl '{print $1/$2}' output > output_2
is there a faster way? (8 Replies)
Discussion started by: programmerc
8 Replies
5. Shell Programming and Scripting
Hi All,
I have a file a.txt, content as mentioned below:
22454750
This data in this control file and
I have a variable called vCount which contains a number.
I need to extract the 22454750 from the above file and compare with the variable vCount. If match fine or else exit.
... (5 Replies)
Discussion started by: Arun Mishra
5 Replies
6. UNIX for Dummies Questions & Answers
hi:
i am trying to understand the concept of the output of ls command, specifically "number of links" for a directory and got utterly confused:
1) when i made first directory in my home directory:
dave@host:~:$ mkdir dir_l1
from the perspective of home directory, the link number for... (2 Replies)
Discussion started by: ipfreak
2 Replies
7. UNIX for Dummies Questions & Answers
I am trying to output two command substitutions echo "$(command) $(command)" with a single echo however when using wc -l within the second substitution, that substitution, instead of appearing in order at the end of the line output, it overwrites the beginning of the output line.
I've tried... (2 Replies)
Discussion started by: somegeek
2 Replies
8. Shell Programming and Scripting
I am trying to output all lines in a file where $7 is less than 30. The below code does create a result file, but with all lines in the original file. The original file is tab deliminated is that the problem? Thank you :).
awk 'BEGIN{FS=OFS=","} $7 < 30 {print}' file.txt > result.txt... (3 Replies)
Discussion started by: cmccabe
3 Replies
9. Shell Programming and Scripting
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies
10. Shell Programming and Scripting
The awk below is supposed to count all the matching $5 strings and count how many $7 values is less than 20. I don't think I need the portion in bold as I do not need any decimal point or format, but can not seem to get the correct counts. Thank you :).
file
chr5 77316500 77316628 ... (6 Replies)
Discussion started by: cmccabe
6 Replies