awk: redrect printf to file and sort


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers awk: redrect printf to file and sort
# 1  
Old 02-12-2007
awk: redrect printf to file and sort

Code:
{ printf "%s %6.2f\n", UserName, pay > payroll_report | sort -nk2 payroll_report; }

this is what I have but it doesnt write the payroll_report file and gives a syntax error for the pipe...help??
# 2  
Old 02-12-2007
Could you paste the entire command please? And if this is an awk command, the sort won't work.
# 3  
Old 02-13-2007
Code:
{ printf "%s %6.2f\n", UserName, pay | tee -a  payroll_report | sort -nk2;}

Assuming that's not, as blowtorch says, an awk... Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter and sort the file using awk

I have file and process it and provide clean output. input file Device Symmetrix Name : 000A4 Device Symmetrix Name : 000A5 Device Symmetrix Name : 000A6 Device Symmetrix Name : 000A7 Device Symmetrix Name : 000A8 Device Symmetrix Name : 000A9 Device Symmetrix Name ... (10 Replies)
Discussion started by: ranjancom2000
10 Replies

2. Shell Programming and Scripting

Not able to sort two fields and printf not displaying the correct values

Not able to sorting two fileds resolved printf issue 01-1000/9|JAN 01-0000/6|MAN 01-1010/2|JAN 01-1010/2|JAN 01-1010/2|JAN 01-1000/9|JAN 01-1000/9|JAN 01-1000/9|SAA 01-1000/9|SAA 01-0000/6|SAN 01-0000/6|SAN 1.sort -t'|' -k1,1n -k2,2 file (3 Replies)
Discussion started by: kalia4u
3 Replies

3. Shell Programming and Scripting

Using awk to sort a file alphabetically

I have a problem with my homework I need to create a shell script using #!bin/awk -f the script will output the file in an alphabetical order only words and after the word is : after that a space then , then it will be numbered each character by which line its been for example CB 92A A... (1 Reply)
Discussion started by: collapse
1 Replies

4. Shell Programming and Scripting

Want to sort a file using awk & sed to get required output

Hi All, Need Suggestion, Want to sort a file using awk & sed to get required, output as below, such that each LUN shows correct WWPN and FA port Numbers correctly: Required output: 01FB 10000000c97843a2 8C 0 01FB 10000000c96fb279 9C 0 22AF 10000000c97843a2 8C 0 22AF 10000000c975adbd ... (10 Replies)
Discussion started by: aix_admin_007
10 Replies

5. Shell Programming and Scripting

awk with printf

Hi, I am using the following code to assign a count value to a variable. But I get nothing. Do you see anything wrong here. I am new to all this. $CTR=`remsh $m -l $MACHINES{$m} -n cat $output | grep -v sent | grep \"$input\" | sort -u | awk '{print $5}'`; Upto sort - u it's... (2 Replies)
Discussion started by: nurani
2 Replies

6. Shell Programming and Scripting

Assigning a specific format to a specific column in a text file using awk and printf

Hi, I have the following text file: 8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm 9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm 10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm 11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies

7. Shell Programming and Scripting

AWK printf help

Target file contains short text (never more than 1 line) and filenames. The format is, e.g.,: TEXT1 filename1 TEXT2 TEXT3 filename3dddd filename3dddd TEXT4 filename4 TEXT5 filename5dddd filename5dddd filename5 where dddd is a random 4-digit whole number. Desired output: (4 Replies)
Discussion started by: uiop44
4 Replies

8. Shell Programming and Scripting

IF and awk/printf

Hi Friends, Scripting newb here. So I'm trying to create a geektool script that uses awk and printf to output certain fields from top (namely command, cpu%, rsize, pid and time, in that order). After much trial and error, I've pretty much succeeded, with one exception. Any process whose name... (3 Replies)
Discussion started by: thom.mattson
3 Replies

9. Shell Programming and Scripting

awk -- sort out the out put file

Hi, using awk /sed, I need to sort out the input file. here is the example input file=== Name= shashi | country= india | region = asia | dept= ww Name= jon | region = asia | dept= xx Name=sam | dept= ww Name= anthony | country=england | dept= xx Name= sumo | country= china output... (3 Replies)
Discussion started by: hegdeshashi
3 Replies

10. Shell Programming and Scripting

awk and printf

echo $bbsize 1.5 echo $fillpercent .95 echo $bbsize | awk '{printf "%.2f\n",$0*$fillpercent}' 2.25 echo $bbsize | awk '{printf "%.2f\n",$0*.95}' 1.42 1.42 is what I'm expecting... echo $blocksize 4096 echo $bbsize | awk '{printf "%.2f\n",$0*$blocksize}' 2.25 echo $bbsize |... (3 Replies)
Discussion started by: xgringo
3 Replies
Login or Register to Ask a Question