Hi all
i am very new to shell scripting,hope u guys can help
i need to replace,sort and append character for the file that look like this:
1007032811010001000100000001X700026930409
1007032811010001000200000002X700026930409
1007032711020001000300000003X700026930409
1007032812010001000100000001X700026930409
1007032817010001000200000002X700026930409
1007032817010001000300000003X700026930409
into a file that look like this:
0
1
2007032711020001000300000003X700026930409
1
2007032811010001000100000001X700026930409
2007032811010001000200000002X700026930409
1
2007032812010001000100000001X700026930409
1
2007032817010001000200000002X700026930409
2007032817010001000300000003X700026930409
0 -----> refer (i) below
1 -----> refer (iii) below
2007032711020001000300000003X700026930409 -----> refer (ii,iii) below
1 2007032811010001000100000001X700026930409
2007032811010001000200000002X700026930409
1
2007032812010001000100000001X700026930409
1
2007032817010001000200000002X700026930409
2007032817010001000300000003X700026930409
basically i need to
i)add '0' for the first line
ii)replace first character if it is '1' to become '2'
iii)group the line based on the sorting (sort -k1.1n) and add one new line of '1' for each line that share the same first 14
how to do all these in one script?huhuuhuh
hope u guys can help(cuz i'm totally blank
)
thanks in advance