Hey, I'm trying to read printf(3) and seems I need to use the * WIDTH
but I'm not quite sure how to go about it.
there needs to be 3 fields per line, the lines read in from file looks like this:
JUICE - APPLE:JUST JUICE:7
MILK - CHOCOLATE:BREAKA:7
this needs to be output backwards with specific justification.
isle number - right justified field width 5
brand name left justified field width 30
product name left justified 30
as so:
is this exactly the same as c++ if so
it should work like
printf("%*5d%30s%30s", arg3, arg2, arg1) or something like that... :P
thnx, the %5d works, it makes it right justified as default, anyway to make the other two left justified?
damn man pages why couldn't they make them easier to understand :S
Hello
Here is an easy one
Data file
12345 (tab) Some text (tab) 53.432
23456 (tab) Some longer text (tab) 933.422
34567 (tab) Some different text (tab) 29.309
I need to awk these three tab-delimited columns so that the first two are unchanged (unformatted) and the third shows two decimal... (1 Reply)
Hi all,
i have written this script:
awk -F';' '
BEGIN {
printf "\n"
printf "\n"
printf "\n"
printf "----------------------------------------------\n"
print " For test "
printf "----------------------------------------------\n"
test_200 = 0
test_300 = 0
test_500 = 0
test_1000 = 0... (11 Replies)
Hi
my awk variable $0 contains the below data
Input file
000001 The Data
000002* The line 2
000003* The line3
output file Req
000001* The Data
000002** The line 2
000003** The line3
one * at column seven needs to be appended to the input lines, (5 Replies)
Hi again:
I have a log file wihch has always this format:
DATA line 1
DATA line 2
^^^^^
| Spaces or TABs
The first line always begins from the start, but the second begins with spaces or TABs,
Question:
How can I add the second line to the first one?
I mean this:
DATA... (6 Replies)
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)
Hi,
I am beginner. have almost one text file which contains 6000 lines. every line is in different format.so need to rearrange in single format.
Ex: .thde.adgtmk.802ati
thde.kghijk..567ati
..thde.kghijk..458ati
thde.ertyui.456.567.789ati
thde.awse.dati
Rules:... (2 Replies)
Hi
I'm using awk to manipulate the data in the 6th field of the file xxx_yyy.hrv.
The sample data that is available in this field is given below
220731.7100000000000000
When i tried using this command
cat xxx_yyy.hrv | awk '{printf("%23.16f\n",$6*-1)}'
I get the output as... (4 Replies)
Hi All,
I have data in the following format.
Australia,"CISCO877-SEC-K9
CISCO1841-ADSL
CISCO2821"
Australia,"CISCO877-SEC-K9
CISCO1841-ADSL
CISCO2821"
Austria,"CISCO871-K9
CISCO1841
CISCO1841-SEC/K9
CISCO1812/K9"
Austria,"CISCO1841-SEC/K9
CISCO1812/K9" (3 Replies)
Hi all,
My simple AWK code does C = A - B
If C can be a negative number, how awk printf formating handles it using string format specifier.
Thanks in advance
Kanu
:confused: (9 Replies)
hi, i would like to extract the header and put it in a variable, then use printf to output the variable, but i keep on getting errors...please tell me if my format is incorrect.
HDR = "`ps -e -o user,pid,ppid,pcpu,stime,etime,time,comm | head -n 1`"
printf (%s, $HDR);
thanks! (3 Replies)