Printing with awk Utility
Trying to use the printf with awk to send some data to print. Here is the statement in my script: echo "$i $state $q_date $project $title" | awk '{ printf "%-11s%-2s%-7s%-17s%-60s\n", $1, $2, $3, $4, $5 }' >>$tempdir/$Manager.msg The problem is that I am trying align the fields - which is OK up to $4, but because the variable $title is several words so the utility only sees the first word in $title and prints it. I tried everything like \"$title\" '$title' ${title} nothing works... By the time awk sees the line, the protecting quotes are already removed. But even if you protected the quotes with backslashes so that awk would receive "My First Report", awk would print "My for $5 because, by default, words are delimited with white space. You can change your word separation to something else such as commas so that an awk field can contain spaces: v3="My First Report"
awk Remove Form Feed I need to create a awk script to remove 2 form feed marks from the beginning of the file. To make sure it will not print 2 empty pages. I cannot make it work. The output will be putting all form feed lines in the begining... -- Begin Script
----------------------------------------
See Also
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|