I want to remove all spaces from a file, except from every line beginning with the same pattern (pattern is ORGANISM).Input:Cat; Dog; SquirrelORGANISM Animalus terrusSequence: ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTOutput:Cat;Dog;SquirrelORGANISM Animalus terrusSequence:ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTNo more spaces in any line except the line starting with the characters ORGANISM.
Remove spaces except lines beginning with a specific pattern
text processing
sed '/^ORGANISM/!s/ //g' /path/to/inputThis will remove all spaces on all lines that do not start with ORGANISM.