1

The scenario is like I have a file called output.txt

I want certain output to be cut from file and remaining text after cut should be moved to another file

for example : my data in file is like below

23: <NAME="ABC_RAM"/> 
24:    <NAME="ABC1"/>
233:      <NAME="ABC_111"/>
300: <NAME="ABC_143"/>
310: <NAME="ABC_XBSKJKSBNSKK"/>

I want to cut from <number : > till first symbol < output should be like below which need to be written to new file

<NAME="ABC_RAM"/> 
<NAME="ABC1"/>
<NAME="ABC_111"/>
<NAME="ABC_143"/>
<NAME="ABC_XBSKJKSBNSKK"/>
2

Using sed:

sed -E 's/^[[:digit:]]+:[[:space:]]+//' file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.