Putting a program on the command-line is usually harder in windows than under unix. This should work.
gawk "length($0)<100{$0=sprintf(\"%-100s\",$0)}1" input_file
If you have mawk, try
mawk "length($0)<100{$0=sprintf('%-100s',$0)}1" input_file
Another way to feed a program to awk:
echo...
Under Solaris, use /usr/xpg4/bin/awk.
This will preserve the spacing between columns.
Put in file "convertfields.awk" and run with
/usr/xpg4/bin/awk -f convertfields.awk /foo
# Produces array of nonmatching and matching
# substrings. The size of the array will
# always be an odd number. The...
awk '/BEGIN/,/END/{next}1' file
works with awk, gawk, and mawk (I just tested it).
You're probably using something antique and obsolete.
If you have nawk, use it instead of awk because on some systems awk is very old and lacks many useful features. Under Solaris, use /usr/xpg4/bin/awk.
And of...
BEGIN { target = "KnownString" }
/^\+/ { sub( /^\+/, "" ); line = line $0 ; next }
{ process( line )
line = $0
}
END { process( line ) }
function process( line )
{
split( line, ary, /[ \t]+/ )
for (i=1; i in ary; i++)
{ if (target == ary[i])
print ary[i+1]
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.