Sponsored Content
Top Forums Shell Programming and Scripting Help with ... Formating the file using awk Post 303018107 by RudiC on Tuesday 29th of May 2018 08:41:39 AM
Old 05-29-2018
Try adding an \n to printf's format string.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help required on file formating

I have two files file1 and file2 as shown below: file1: name nameabc bcd nameabcdefg file2: age age1111 age2345 age6743 I have pasted one file on the other with the delimiter "|" and the resulttant file is: name|age nameabc|age1111 bcd|age2345 nameabcdefg|age6743 (1 Reply)
Discussion started by: udiptya
1 Replies

2. Shell Programming and Scripting

AWK: formating number without printf

Hello, I wrote a script that does lot of things, and I would like to change the format of a number but without printing it now (so I don't want to use printf as it will print the value immediately). Schematically here is what I have: awk 'BEGIN{number=0.01234567} $1==$2{$3=number}... (5 Replies)
Discussion started by: jolecanard
5 Replies

3. Shell Programming and Scripting

file formating in Perl

Hi, I am new to unix , I have a requirement for formating the input file and generate the output file as per the downstream requirement .. My application receiving a text input file having 4 field and my application need to check each field and if some value of a field is blank ..then it need... (1 Reply)
Discussion started by: julirani
1 Replies

4. UNIX for Dummies Questions & Answers

File formating help needed.

I have a file called vm.cfg . content of file. acpi = 1 apic = 1 builder = 'hvm' How would i write a script which will add boot = 'd' at 3rd line. For example. after running the script the file should be like below. acpi = 1 apic = 1 boot = 'd' builder = 'hvm' I dont want to... (3 Replies)
Discussion started by: pinga123
3 Replies

5. Shell Programming and Scripting

Help in formating a txt file

Pls help in formatting a txt file using shell scripting Input file format: Name priya 2010-09-21 10:43:49 TEXT ID 1 hi TEXT ID 2 how TEXT ID 3 r TEXT ID 4 u Output required: name priya hi how r u (4 Replies)
Discussion started by: bha148
4 Replies

6. Shell Programming and Scripting

formating sql file using awk or sed

Hi, I have a file where I would like to add a prompt type object_name statement before every create commnad create or replace force view test_view_01 ( col1 col2 col3 ) as (select a,b,c from sometable ); create or replace view test_view_02 ( col4 col5 col6 ) as (5 Replies)
Discussion started by: jville
5 Replies

7. UNIX for Beginners Questions & Answers

File formating with lines

Hi All, Need to modify a file basically join the extra line to one I am having a file like below And would like to make it as below . (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

8. UNIX for Beginners Questions & Answers

File formating help

Hi all, I am having the file below I need that as below Thanks, Arun (12 Replies)
Discussion started by: arunkumar_mca
12 Replies

9. Shell Programming and Scripting

File formating

I need to create a fixed width file based on the column lengths. lets assume I have six(this may be dynamic) fields each are of different length column1=6 #size of the column column2=3 column3=2 column4=3 column5=4 column6=5 I tried below code snippet but it is not working echo... (4 Replies)
Discussion started by: gvkumar25
4 Replies

10. UNIX for Beginners Questions & Answers

awk HTML Conditional Formating

I am receiving the below output in text format. The output is converted to HTML table using the code mentioned below output in text LogDate DayOfWeek/Hours _0_ _1_ _2_ _3_ _4_ _5_ _6_ _7_ _8_ _9_ _10_ _11_ _12_ _13_ _14_ _15_ _16_ ... (3 Replies)
Discussion started by: Dumpi16
3 Replies
printf(3int)															      printf(3int)

Name
       printf, fprintf, sprintf - print formatted output

Syntax
       #include <stdio.h>

       int printf ( format [, arg ] ...  )
       char *format;

       int fprintf ( stream, format [, arg ] ...  )
       FILE *stream;
       char *format;

       int sprintf ( s, format [, arg ] ...  )
       char *s, *format;

Description
       The  international functions and are similar to the standard I/O functions. The difference is that the international functions allow you to
       use the %digit$ conversion character in place of the % character you use in the standard I/O functions. The digit is a decimal digit n from
       1 to 9.	The international functions apply conversions to the n th argument in the argument list, rather than to the next unused argument.

       You can use the % conversion character in the international functions.  However, you cannot mix the % conversion character with the %digit$
       conversion character in a single call.

       You can indicate a field width or precision by an asterisk (*) instead of a digit string in format  strings  containing	the  %	conversion
       character.  If you use an asterisk, you can supply an integer arg that specifies the field width or precision. In format strings containing
       the %digit$ conversion character, you can indicate field width or precision by the sequence *digit$.  You use a decimal digit from 1  to  9
       to indicate which argument contains an integer that specifies the field width or precision.

       The conversion characters and their meanings are identical to

       You must use each digit argument at least once.

       In  all	cases, the radix character uses is defined by the last successful call to category If category has not been called successfully or
       if the radix character is undefined, the radix character defaults to a period (.).

   International Environment
       LC_NUMERIC     If this environment is set and valid, uses the international language database named in the definition  to  determine  radix
		      character rules.

       LANG	      If  this environment variable is set and valid uses the international language database named in the definition to determine
		      collation and character classification rules.  If is defined, its definition supercedes the definition of LANG.

Examples
       The following example illustrates using an argument to specify field width:
       printf ("%1$d:%2$.*3$d:%4$.*3$d
",
			   hour, min, precision, sec);
       The format string *3$ indicates that the third argument, which is named precision, contains the integer field width specification.

       To print the language independent date and time format use the following statement:
       printf (format, weekday, month, day, hour, min);
       For American use, format could be a pointer to the following string:
       "%1$s,  %2$s %3$d, %4$d:%5$.2d
"
       This string gives the following date format:
       Sunday, July 3, 10:02
       For use in a German environment, format could be a pointer to the following string:
       "%1$s, %3$d. %2$s, %4$d:%5$.2d
"
       This string gives the following date format:
       Sonntag, 3. Juli, 10:02

Return Values
       and return zero for success and EOF for failure.  The subroutine returns its first argument for success and EOF for failure.

       In the System V and POSIX environments, and return the number of characters transmitted for success.  The function ignores the null  termi-
       nator () when calculating the number of characters transmitted.  If an output error occurs, these routines return a negative value.

See Also
       intro(3int), setlocale(3), scanf(3int), printf(3s), putc(3s), scanf(3s), stdio(3s)
       Guide to Developing International Software

																      printf(3int)
All times are GMT -4. The time now is 10:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy