Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- P1
- 10,9:11/18013013582
- ,10:1
- ,167:0
- ,487:5/E.164
- 11,9:15/310410532169026
- ,10:60
- ,167:0
- ,487:4/IMSI
- 12,18:15/013329002130500
- ,19:0
- 15,9:10/9609610015
- ,10:1
- ,14:68
- ,167:0
- ,436:5/ABCDE
- ,487:5/E.164
- 16,87:1
- 17,9:10/8013765024
- ,10:1
- ,11:1
- ,12:0
- ,167:0
- ,487:5/E.164
- 23,9:11/13123149810
- ,10:1
- ,11:1
- ,167:0
- ,487:5/E.164
- P3
- 42,3:1.
- ,4:3
- ,300:1.
- 43,3:1.
- ,4:3
- ,300:1.
- 44,3:0.
- ,4:7
- ,300:0.
- 45,5:0.3
- nawk -v fname="${filename}" -F '/|:' '
- function isnum(x){return(x==x+0)}
- /P1/,/P3/{
- # Found start increment i reset variables go to next line
- if(/P1/){
- ++i
- fid =""
- count++
- next
- }
- # Found end validate variable and print go to next line
- if(/P3/){
- printf "%s|",count
- printf "%s|",isnum(fid)?fid:"NULL"
- next
- }
- if(!fid && /36,59:*/)
- {
- fid = $NF
- }
- ' ${filename} >>output.txt
- 17[,0-9:]*[n]*,11
- $ awk -F/ '$2~/^80/{print; getline; print; getline; $1=",11.2"}1' file1.txt
- P1
- 10,9:11/18013013582
- ,10:1
- ,167:0
- ,487:5/E.164
- 11,9:15/310410532169026
- ,10:60
- ,167:0
- ,487:4/IMSI
- 12,18:15/013329002130500
- ,19:0
- 15,9:10/9609610015
- ,10:1
- ,14:68
- ,167:0
- ,436:5/ABCDE
- ,487:5/E.164
- 16,87:1
- 17,9:10/8013765024
- ,10:1
- ,11.2
- ,12:0
- ,167:0
- ,487:5/E.164
- 23,9:11/13123149810
- ,10:1
- ,11:1
- ,167:0
- ,487:5/E.164
- P3
- 42,3:1.
- ,4:3
- ,300:1.
- 43,3:1.
- ,4:3
- ,300:1.
- 44,3:0.
- ,4:7
- ,300:0.
- 45,5:0.3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement