Required column output should be arranged in awk


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Required column output should be arranged in awk
# 1  
Old 01-05-2020
Required column output should be arranged in awk

dump file
Code:
2020-01-05 & 234135    ossuser    4      CACLP;   
2020-01-05 & 234207    ossuser    3      CACLP;   
2020-01-05 & 234307    ossuser    1002      CACLP;
2020-01-05 & 234427    ossuser    0      CACLP;   
2020-01-05 & 234429    ossuser    1      CACLP;

Command used awk '{print $6," "$7}' dump file

got
Code:
4      CACLP;  
3      CACLP;  
1002      CACLP;
0      CACLP;  
1      CACLP;


Required output
Code:
4            CACLP;  
3            CACLP;  
1002      CACLP;
0            CACLP;  
1             CACLP;

Moderator's Comments:
Mod Comment Please do wrap your samples and codes in CODE TAGS as per forum rules.

Last edited by RavinderSingh13; 01-05-2020 at 10:00 PM..
# 2  
Old 01-05-2020
Your parameters seem to actually be $5 and $6. You can do something like...
Code:
awk '{printf("%5s%10s\n",$5,$6)}' <filename>

or
Code:
awk '{printf("%-5s%10s\n",$5,$6)}' <filename>

This User Gave Thanks to blackrageous For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Convert rows to column and print output in required format

Hi All, i am trying to print the solaris 11 packages in below required format, But i am unable to do that. Current ouput : root@abc# pkginfo -l | egrep '(BASEDIR|NAME|VERSION)' | awk '{print}' NAME: QLogic 570x/571x Gigabit Ethernet Driver VERSION: 11.11,REV=2009.11.11 ... (7 Replies)
Discussion started by: balu1234
7 Replies

2. UNIX for Advanced & Expert Users

Parse output and then compare column wise with awk

Hello, I am trying to write a script to parse the output of data and then alert based on certain conditions This is the output of my script (STRING) Name = Joe (FLOAT64) BMI = 34 (FLOAT64) Weight = 156 (STRING) Name = Sam (FLOAT64) BMI = 32 (FLOAT64) Weight = 180 and so on it repeats... (4 Replies)
Discussion started by: sidnow
4 Replies

3. Shell Programming and Scripting

awk or grep to search one column and output the other

Hello, it would be great if someone can help me with the following: I want to search for the rows from fileA in column 1 of fileB and output column 2 of fileB if found in fileC. In the moment I search within the complete file. How can I change the code so only column 1 is searched? cat fileA... (7 Replies)
Discussion started by: Manyaka
7 Replies

4. UNIX for Dummies Questions & Answers

Print each output of loop in new column using awk or shell

I have this output from a loop a11 1,2 3,4 5,6 7,8 12,8 5,4 3,6 a12 10,11 12,13 15,18 20,22 a13 ... (3 Replies)
Discussion started by: maryre89
3 Replies

5. Shell Programming and Scripting

How to sum multiple column output with awk ?

Hi Experts, I am trying to sum multiple columns and rows with awk , I want the sum of : 1] Horizontal Sum: (rows sum): 2] Vertical Sum: (Column's sum] details: # cat file1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 40 31 32 33 34 35 36 37 38 39 70 41 42 43 44... (2 Replies)
Discussion started by: rveri
2 Replies

6. Shell Programming and Scripting

Want to sort a file using awk & sed to get required output

Hi All, Need Suggestion, Want to sort a file using awk & sed to get required, output as below, such that each LUN shows correct WWPN and FA port Numbers correctly: Required output: 01FB 10000000c97843a2 8C 0 01FB 10000000c96fb279 9C 0 22AF 10000000c97843a2 8C 0 22AF 10000000c975adbd ... (10 Replies)
Discussion started by: aix_admin_007
10 Replies

7. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

8. Shell Programming and Scripting

Find in first column and replace the line with Awk, and output new file

Find in first column and replace the line with Awk, and output new file File1.txt"2011-11-02","Georgia","Atlanta","x","","" "2011-11-03","California","Los Angeles","x","","" "2011-11-04","Georgia","Atlanta","x","x","x" "2011-11-05","Georgia","Atlanta","x","x","" ... (4 Replies)
Discussion started by: charles33
4 Replies

9. Shell Programming and Scripting

finding greatest value in a column using awk from iostat output in linux

Friends, Need some help. On linux i have to run iostat command and in each iteration have to print the greatest value in each column. e.g iostat -dt -kx 2 2 | awk ' !/sd/ &&!/%util/ && !/Time/ && !/Linux/ {print $12}' 4.38 0.00 0.00 0.00 WHhat i would like to... (15 Replies)
Discussion started by: achak01
15 Replies

10. Shell Programming and Scripting

finding greatest value in a column using awk from iostat output in linux

Friends, . On linux i have to run iostat command and in each iteration have to print the greatest value in each column. e.g iostat -dt -kx 2 2 | awk ' !/sd/ &&!/%util/ && !/Time/ && !/Linux/ {print $12}' 4.38 0.00 0.00 0.00 What i would like to print is only the... (3 Replies)
Discussion started by: achak01
3 Replies
Login or Register to Ask a Question