While concatenating 2 values, one which expanded to fixed width & other not, I am not getting value expanded as fixed width.
Following is script for the same :
#!/bin/sh
var1="abc"
var2="def"
var1Fxd=`echo $var1 | awk '{printf("%-6s",$0)}'`
echo $var1Fxd""$var2
But, if I try -
echo... (2 Replies)
How do I trim the leading zeroes, and (+,-) in the currency field ?
I have a text file.
Your bill of +00002780.96 for a/c no. 25287324 is due on 11-06.
Your bill of +00422270.48 for a/c no. 28931373 is due on 11-06.
I want the O/P file to be like.
Your bill of 2780.96 for a/c no. 25287324... (22 Replies)
Hello,
Could someone please help me to convert a string(s) of comma separated values into space padded columns in .ksh?
ex.
10-21-2008,someword,blah,127.0.0.1,8,3
10-21-2008,randomword,ick,128.0.111.128,1,0
converted to
10-21-2008 someword blah 127.0.0.1 8... (6 Replies)
Hi all. Im trying to use a sequence in a while loop like this below. I need it for navigating a year, month, day folder structure where a user can input the start date and have it go to the desired end date. The script will grab a certain file on each day then move onto the next. Ive got all that... (3 Replies)
I’m looking for an elegant way to convert a delimited file (comma delimited in this case) to padded columns (for printing in non-proportional font) but the length of each column is not known ahead of time. It needs to be calculated for each column from the longest entry in that column in a given... (3 Replies)
There are two columns on the data base table, create and update timestamps of datatype timestamp.
I dont have these fields on the csv file. So I am doing the below.
awk -F , -v d="$(date "+ %Y-%m-%d-%H.%M.%S")" '{ OFS=FS; print $1, $2, $3, $4, d, $5, $6, d }' temp.csv > temp1.csv
and then... (3 Replies)
Hello, here is the outout of the command below.. Can someone please tell me how to get the output as below
output needed:
18914,30716,17051,4139,14155...
( no comma for the last value)
ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head | awk '{print $2}'
18914
30716
17051
4139... (10 Replies)
Is possible to print padded string in printf?
Example
echo 1 | awk '{printf("%03d\n", $1)}'
001I want
S1
S11
S2
S21to be padded as:
S01
S11
S02
S21Thanks! (26 Replies)
Discussion started by: yifangt
26 Replies
LEARN ABOUT DEBIAN
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)