Hi Friends,
I am trying to insert lines of the below format in a file:
I am formatting the strings as follows using awk printf:
The above code does not work when the length of feild 1 varies.
Example, I get results as shown below:
Please let me know how to modify the prinf in awk to achieve this.
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)
I am trying to use printf with a character string that is used within a do loop. The problem is that while in the loop, the printf prints the variable name instead of the value. The do loop calls the variable name from a text file (called device.txt):
while read device
do
cat $device.clean... (2 Replies)
Hi I'm having a problem with converting a file:
ID X
1 7
1 8
1 3
2 5
2 7
2 2
To something like this:
ID X1 X2 X3
1 7 8 3
2 5 7 2
I've tried the following loop:
for i in `cat tst.csv| awk -F "," '{print $1}'| uniq`;do grep -h $i... (4 Replies)
hi all
can any one help me to understand this
bdf -t vfxs | awk '/\//{printf("%-30s%-10s%-10s%-10s%-5s%-10s\n",$1,$2,$3,$4,$5,$6)}'
i want to understand the numbers %-30S% (4 Replies)
Hi,
I need to insert a line at a particular line number. I am using the below code:
sed $REV_LINO_NO" i\\
# $CURRENT_DATE $NAME Changed pwd for cindy\'s id" file > file1
This code works, but the formatting is not as I expected. For example, I get lines as shown below... (2 Replies)
Hi All,
I am attempting to create a fixed length tilde delimited file using printf.
The variables are initialized to fixed length blank spaces
a=' '
b=' '
c=' '
d=' '
Sometimes the variable might contain values and sometimes they are... (5 Replies)
Hi All
I am working to process txt file into csv commo separated.
Input.txt
1,2,asdf,34sdsd,120,haahha2
2,2,wewedf,45sdsd,130,haahha
.....
....
Errorcode.txt
120
130
140
myawk.awk code:
{
BEGIN{
HEADER="f1,f2,f3,f4,f5,f6" (4 Replies)
Hi,
I haven't programed in C in a few years. I have been doing a lot of shell scripting, I.E. not really programming anything heavy. :o
That said, I have a script that gives hourly usage statistics for our email server. It runs w-a-y to slow as a script for my impatience, and needs to... (7 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 HPUX
inttypes
inttypes(5) File Formats Manual inttypes(5)NAME
inttypes - fixed size integer data types
SYNOPSIS DESCRIPTION
This header file defines integer data types of various sizes. By using the data types defined in this header file, developers can be
assured that the data types will have the same properties and behavior on different systems.
Since not all implementations are required to support all of the integer sizes defined in this manual page, the proper way to see if a par-
ticular size of an integer is supported on the current implementation is to test the symbol that defines its maximum value. For example,
if tests false, then that implementation does not support 64-bit unsigned signed integers.
The header includes header.
This header file defines the following data type.
structure type that is the type of the value returned by the
function
The following macros can be used as formatting options with the family of functions (see printf(3S)). These macros are used to select the
correct formatting option for the integer data types defined earlier in this manual page.
The following macros can be used as formatting options with the family of functions (see scanf(3S)). These macros are used to select the
correct formatting option for the integer data types defined earlier in this manual page.
Notes
The formatting options for the family of functions all begin with whereas the formatting options for the family of functions all begin with
These formatting strings may not be interchangeable.
EXAMPLES
The following example shows how to use one of the print formatting options with the function.
AUTHOR
was developed by HP.
FILES SEE ALSO imaxdiv(3), printf(3S), scanf(3S), standards(5), stdint(5).
inttypes(5)