Hello Guru's
I read over a file many times to change certain patterns with another, predefined pattern, in this case, an empty "".
Really just removing things I don't need.
But, it involves reading the file in over & over again applying sed to a certain pattern.
Somehow I think there must be a way to do grab many patterns and all replace them with an "" in a more intelligent manner.
So, this is what the file might look like:
$cat input_file
one two three four five six
two three four five seven
If I now have to remove "one" and "seven" from the source file, this is how I do it quick & dirty:
$sed 's/one//g' input_file > output_file
$sed 's/seven//g' output_file > output2_file
Obviously this works, but it involves scanning a file 2 times.
How can one define a range of patterns to be all replaced by a fixed pattern (in this case "") in 'just one go' over the file ?
Thanks,
Iga
I read over a file many times to change certain patterns with another, predefined pattern, in this case, an empty "".
Really just removing things I don't need.
But, it involves reading the file in over & over again applying sed to a certain pattern.
Somehow I think there must be a way to do grab many patterns and all replace them with an "" in a more intelligent manner.
So, this is what the file might look like:
$cat input_file
one two three four five six
two three four five seven
If I now have to remove "one" and "seven" from the source file, this is how I do it quick & dirty:
$sed 's/one//g' input_file > output_file
$sed 's/seven//g' output_file > output2_file
Obviously this works, but it involves scanning a file 2 times.
How can one define a range of patterns to be all replaced by a fixed pattern (in this case "") in 'just one go' over the file ?
Thanks,
Iga