I need help extracting certain part of line from file.
Here is how my file looks like:
testfile.txt
This is a test line 1 $#%#
This is a test line 2 $#%#
This is a test line 3 $#%#
This is a test line 4 $#%#
This is a test line 5 $#%#
This is a test line 6 $#%#
This is a test line 7 $#%#
and here is my bash script:
#!/bin/bash
while read line
do
#echo $line
FilterString=${line:22:26}
echo $FilterString>>testfile2.txt
done<testfile.txt
The above script gets the string $#%# and writes to temp file
My Question:
Instead of writing the string $#%# i want everything except string $#%# written to file.
So i want my final output file to look like:
testfile.txt
This is a test line 1
This is a test line 2
This is a test line 3
This is a test line 4
This is a test line 5
This is a test line 6
This is a test line 7
Please also suggest me the best tool for doing it
Thanks in advance.