Reputation: 808
I am genereting txt information with tcpdump. In output there is lots of information which contains something like that for instance:
Cookie: id=8xdza1ud39t459hv5bkth4t9gx71dicp; _ga=GA1.2.1890484279.1447252334; __gfp_64b=64smeVuOU7LSnfV8__mvHUkZFQF4lddYYY2X0c0HYAj.S7; __gads=ID=6ccc5cd620798f1a:T=1451575639:S=ALNI_MYeOVLFzU3qJTBxFq6KrdK10QDVrg; __utma=37331766.1890484279.1447252334.1451770396.1451770396.1; __utmz=37331766.1451770296.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); PHPSESSID=70c71a0c25d7d0425c657cee8f30dc2d; OX_sd=1; OX_plg=swf|shk|pm; _gat=1; _gat_newTracker=1; id=iyybhxg7524r2gcuvpguzvbse18c9c21
Is it possible to cut only this info from what i have and send it to another output? To match above cookie it needs to be a string which starts with "Cookie" ,ends with "id" atribute and contains "PHPSEESSID".
Upvotes: 0
Views: 1183
Reputation: 10149
You coud try something like grep -E "^Cookie:.*PHPSESSID.* id=[^ ]+$"
.
It matches a line that
^
) with Cookie:.*PHPSESSID.*
)$
) with an id=
field, due the [^ ]
which prohibits spaces following the id=
Upvotes: 2