I want to remove the &
from all the line
?daypartId=1&catId=1
?daypartId=1&catId=2
?daypartId=1&catId=11
?daypartId=1&catId=10
?daypartId=1&catId=6
?daypartId=1&catId=4
?daypartId=1&catId=14
?daypartId=1&catId=5
?daypartId=1&catId=3
?daypartId=1&catId=8
Expected output:
?daypartId=1&catId=1
?daypartId=1&catId=2
?daypartId=1&catId=11
?daypartId=1&catId=10
?daypartId=1&catId=6
?daypartId=1&catId=4
?daypartId=1&catId=14
?daypartId=1&catId=5
?daypartId=1&catId=3
?daypartId=1&catId=8
removing &
from the input is what i need. I am stuck at this problem please help.
You could do simply with sed like below:
sed 's/amp;//' myfile.txt
This would search for amp;
and replace it with an empty string in a file called myfile.txt
If you want to replace it within the file, then you could use -i option as below:
sed -i 's/amp;//' myfile.txt
If you have multiple such occurrences in a line, you could use a global replacement as below:
sed 's/amp;//g' myfile.txt