10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
The awk below executes and produces the current output. it skips the header in row 1 and prints $4,$5,$6 and then adds the header row back.
The problem is that it keeps the tailing tab and prints it in front of $1. I could add a pipe to remove the tab, but is there a better way to do it with on... (7 Replies)
Discussion started by: cmccabe
7 Replies
2. Shell Programming and Scripting
In the below awk written by @RavinderSingh13 I have added a few lines and am trying to have the output be tab-delimited. The input is space-delimeted and the portion in bold seems to add a tab to the Not found but not the found. Thank you :).
file1
One 1
Two 2
Three 3
file2
One 1... (2 Replies)
Discussion started by: cmccabe
2 Replies
3. Shell Programming and Scripting
I am just trying to output the below awk separated by tabs. Thank you :).
awk (added OFS as an attempt to itroduce tabs)
awk '{split($5,a,"-"); OFS='\t' print $1,$2,$3,a}' file.bed > test.bed
The awk runs and produces all the data in 1 field instead of 4 fields.
current output
... (2 Replies)
Discussion started by: cmccabe
2 Replies
4. Shell Programming and Scripting
Input file:
xyz,pqrs.lmno,NA,NA,NA,NA,NA,NA,NA
abcd,pqrs.xyz,NA,NA,NA,NA,NA,NA,NA
Expected Output:
xyz pqrs.lmno NA NA NA NA NA NA NA
abcd pqrs.xyz NA NA NA NA NA NA NA
Command Tried so far:
awk -F"," 'BEGIN{OFS=" ";} {print}' $File_Path/File_Name.csv
Issue:... (5 Replies)
Discussion started by: TechGyaann
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies
6. Shell Programming and Scripting
Dear All,
Good Day. I would like to hear your suggestions for the following problem:
I have a file with 5 columns with some numbers in 16 lines as shown below.
Input file:
Col 1 Col 2 Col 3 Col 4 Col 5
12 220 2 121 20
234 30 22 9... (3 Replies)
Discussion started by: Fredrick
3 Replies
7. Shell Programming and Scripting
Wants to print line when there exist leading or trailing space or tab in fields 2,3 and 5
The below code prints all lines in file even if they dont have leading and trailing space or tab.
nawk -F"|" '{for(i=1;i<=NF;i++) {if ($i ~ "^*" || $i ~ "*$")}}1' file
file
Ouput required:
... (5 Replies)
Discussion started by: pinnacle
5 Replies
8. UNIX for Advanced & Expert Users
Dear all,
I have a file with 5L records. one of the record in the file is as shown below.
MARIA THOMAS
BASIL
1000 FM 1111 MD
... (1 Reply)
Discussion started by: OSD
1 Replies
9. Shell Programming and Scripting
Dear all,
I have a file with 5L records. one of the record in the file is as shown below.
MARIA THOMAS
BASIL
1000 FM 1111 MD
GHANA
YY 77354 4774
99999999 1234567
I need to convert this record in below format
"","","","","MARIA","THOMAS","BASIL","","1000 FM 1111 MD","STE... (1 Reply)
Discussion started by: OSD
1 Replies
10. Shell Programming and Scripting
Hi
I have tried this command
cat /etc/passwd | awk -F: '{print$5}'
note that the $5 is the column that displays full name- i.e. Kevin Kambell
To the point, my output is fine except one thing I do not understand that some of output lines have space in front of them which I checked in... (7 Replies)
Discussion started by: lalelle
7 Replies