I'm fairly good with grep, cut, sed, etc. However, I'm having a tough time extracting this data from a file. It looks like this:
--timestamp-- data://example1// -----| This could be anything or nothing
--timestamp-- data://example2// -----| This could be something
--timestamp-- data://example3// -----|
--timestamp-- data://example4// -----| This could something else
--timestamp-- data://example5// -----| This could be another something
--timestamp-- data://example6// -----|
--timestamp-- data://example7// -----| This could something else
I would like to return all lines that have anything after the string -----| so the output would be:
example1
example2
example4
example5
example7
I know that I need to use an IF statement based on a grep '-----|.*$' match. It would be if there is any characters after the string, then output the line. Then, I could pipe to an awk command that would extract between the delimiters // before and after example. I'm just really stuck on how to structure the if statement.
Any help with this IF statement would be very appreciated.
Aucun commentaire:
Enregistrer un commentaire