Reputation: 4349
The current code below the grep & cut is outputting 51315123&category_id
, I need to remove &category_id
can cut be used to do that?
... | tr '?' '\n' | grep "^recipient_dvd_id=" | cut -d '=' -f 2 >> dvdIDs.txt
Upvotes: 5
Views: 17166
Reputation: 2109
If you're open to using AWK:
... | tr '?' '\n' | awk -F'[=&]' '/^recipient_dvd_id=/ {print $2}' >> dvdIDs.txt
AWK handles the regex and splitting fields, in this case using both '=' and '&' as field separators and printing the second column. Otherwise, you will need a second cut
statement.
Upvotes: 2