1

I am writing a bash script for the processing of the files. I have several .xvg files which contain the XY info to plot the data. Somewhere inside of the each of the file there is a string:

@ s0 legend "SOD-r_58_&_C-alpha"

(It always start with "@ s0 legend".)

Could you suggest me the one string bash solution using awk or grep to find and remove this string from the file, remove the empty line in the place and finally save the processed file under a different name?

Micha Wiedenmann
  • 19,979
  • 21
  • 92
  • 137
  • Here's an example of searching for string `1337` and setting an actionable variable: https://github.com/e-ht/so-ckssh5/blob/master/killsocks.sh#L3 –  Jan 19 '18 at 08:16
  • but that is for the killing processes no the editing on the txt files :-)) –  Jan 19 '18 at 08:21
  • the best solution that I have found: sed '/s0 legend*/d' –  Jan 19 '18 at 08:34
  • since you want to save the results in another file, use grep.. it would be faster than sed – Sundeep Jan 19 '18 at 08:57

0 Answers0