Apologies... Code that I shared earlier is incorrect, revising...
Revised Question:
First of all, I would like to apologize for the rush, I am new in QSHELL and just started learning.. But I badly need your help as I need to integrate the following to my program as soon as possible..
Basically the scenario is, a text file containing invalid/special characters was uploaded into our server and my program must remove them before processing.
so for example, I have uploadfile.txt and it contains below.
To replace the special characters I am using the following command and it works fine.
sed -e 's/[^a-zA-Z0-9&,-]/ /g' uploadfile.txt > outputfile.txt
a to zlowercase (a-z)A to Zuppercase (A-Z)0-9&Ampersand,Comma.Period
However, before replacing I need to extract the lines for reporting/communication purposes and I am not quite sure how and got stuck... Tried to search however I still cant get it and I am running out of time..
So my question is, How can I extract line numbers 2, 4, 5 into a separate text.file?
Thanks in advance.
This has been resolved, I used below command as suggested by @adminbee in the comments.
sed -n '/[^[:print:]]/p' IFS/MM4R5FLR/S06013/myfile.POL > myfile.pol
Thank you everyone for the help.
