10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,I've a unix pipe delimited file as below f1|f2|f3|f4|f5|f6 My requirement is to pad spaces on the left to fields f2, f3 and f5. Field Lengths according to file layout f2 - 4 char f3 - 5 char f5 - 3 char If my record is as below 1|43|bc|h0|34|a Output record should be as below 1| 43| bc|h0|... (4 Replies)
Discussion started by: Soujanya_K
4 Replies
2. Shell Programming and Scripting
Hi guys,
I need AWK to merge the following 2 files:
file1
1 a 1 1
2 b 2 2
3 c 3 3
4 d 4 4
file2
a a/a c/c a/c c/c a/a c/t
c c/t c/c a/t g/g c/c c/t
desired output:
1 a 1 1 a/a c/c a/c c/c a/a c/t
2 b 2 2 x x x x x x
3 c 3 3 c/t c/c a/t g/g c/c c/t
4 d 4 4 x x x x x x (2 Replies)
Discussion started by: g1org1o
2 Replies
3. Shell Programming and Scripting
Hi guys,
I need to use awk to join 2 files
file_1
A 001
B 002
C 003
file_2
A XX1
B XX2
output desired
A 001 XX1
B 002 missing
C 003 XX2
thank you! (2 Replies)
Discussion started by: g1org1o
2 Replies
4. Shell Programming and Scripting
When the line contains abc, it will goes to the next line and substitue the MM to NN
bc 23 33
abc 23 33
ddd MM xx
dff MM 33
cat xxx |awk '{if ($0~/abc/){getline;sub(/MM/,"NN")}{print}}', It doesn't show "abc 23 33
bc 23 33
ddd NN xx
dff MM 33
bc 23 33
abc 23 33
ddd NN xx... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
5. Shell Programming and Scripting
I am passing input string,length, and the pad character.
input string=123
Pad char=#
Length=6
then the output should be:
###123
How we can do this?
Thanks (5 Replies)
Discussion started by: pandeesh
5 Replies
6. Shell Programming and Scripting
Hello, i am trying to pad a column
A1
A2
A10
B2
B8
B12
to look like
A01
A02
A10
B02
B08
B12
using awk (6 Replies)
Discussion started by: mykey242
6 Replies
7. Shell Programming and Scripting
Hello,
I want to get the User Name details of a user from a file list.
This list can be in the format:
FirstName_MiddleName1_LastName_ID
FirstName_LastName_ID
FirstName_MiddleName1_MiddleName2_LastName_ID
What i want it to return is FirstName_MiddleName1_LastName of a user.
I... (6 Replies)
Discussion started by: limamichelle
6 Replies
8. Shell Programming and Scripting
nawk 'NR==FNR{a;next} {if($1 in a) print $1,"Found" else print}' OFS="," File_B File_A
The above code is not working help is appreciated (6 Replies)
Discussion started by: pinnacle
6 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I am trying to parse a file of fixed length transactions into a new file. Using awk I need to add the line number as a 5 digit long numeric value to each of the transactional rows.
i.e.
awk '{print <ROW NUM PADDED HERE>substr($0,1,8).........}' filename > newfile
I know that NR-1... (3 Replies)
Discussion started by: kshelluser
3 Replies
10. UNIX for Dummies Questions & Answers
Hi, can someone please tell me how to left-pad numbers using unix.
e.g. 1234 -> 00001234
Thanks in advance for your help. (1 Reply)
Discussion started by: colquhoi
1 Replies