shell - How to extract a specific number sequence in a file -
hi wanted ask regarding on how create shell script reads file extracts values outputs in file
here content of file:
some.ip.address,,0530,,,**134148.117132,134148.117176,134148.117693,134148.117712**,,,,,,134148.114552,,,,,0000016972,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016972 http/1.1 some.ip.address,,0530,,,134118.111838,134118.111881,134118.112469,134118.112488,,,,,,134118.109233,,,,,0000016912,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016912 http/1.1 some.ip.address,,0530,,,134148.120441,134148.120471,134148.120955,134148.120973,,,,,,134148.117845,,,,,0000016973,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016973 http/1.1 some.ip.address,,0530,,,134118.114515,134118.114559,134118.115044,134118.115061,,,,,,134118.111938,,,,,0000016913,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016913 http/1.1 some.ip.address,,0530,,,134149.117256,134149.117324,134149.117916,134149.117935,,,,,,134149.114722,,,,,0000016974,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016974 http/1.1 some.ip.address,,0530,,,134119.111996,134119.112040,134119.112663,134119.112682,,,,,,134119.109432,,,,,0000016914,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016914 http/1.1 some.ip.address,,0530,,,134149.120156,134149.120186,134149.120691,134149.120709,,,,,,134149.117374,,,,,0000016975,172.28.61.176,,,443,192.168.5.208,,,109,0,0,0,0,0,92,14,0,0,0,0,,,,200,,,text/html,,get ?fname=111.txt&seqnum=0000016975 http/1.1
now need extract values in bold , out put in csv file need !!
you can use cut
syntax like,
while read line echo $line | cut -f <required fields> -d "," >> newfile.csv done < inputfile
syntax not perfect do.
Comments
Post a Comment