Quantcast
Viewing latest article 3
Browse Latest Browse All 4

Answer by Kartik Sabharwal for Extracting String between given token

If all the lines in the file will be structured like the example, I believe you can use the command line program cut to treat the percent signs as field delimiters and pick the 2nd and 4th fields. So try running

cut -d "%" -f 2,4 --output-delimiter=","<file_name

Update:I don't think anything needs to be changed for the other format becausein the pattern %string% the command above sees string as the second field and extracts it. I tried running

echo "%string%" | cut -d "%" -f 2,4 --output-delimiter=","

and string was printed to standard output.


Viewing latest article 3
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>