Issue
I have 100s of enormous text files in the form of
p 127210 3240293 23423234 3242323423
3242323 23423423 23423234 32423423
127210 3240293 23423234 3242323423
3242323 23423423 23423234 32423423
I've tried using
sed '1 s/^.//' input > output
but that gives me
127210 3240293 23423234 3242323423
3242323 23423423 23423234 32423423
i.e. an annoying space where the p was. Can anyone help me modify the sed expression to get the output without the space?
Thanks
Solution
Following awk
may help you in same.
awk '!/^[0-9]+/{$1="";$0=$0;$1=$1} 1' Input_file
Explanation: Checking condition !/^[0-9]+/
which will check if a line doesn't start from digits then do following, then I am nullifying first field here(because you don't want p
in output here), then I am re-arranging $0
(current line) and re-arranging $1
too so that it could remove that initial space as per your request here.
Output will be as follows.
127210 3240293 23423234 3242323423
3242323 23423423 23423234 32423423
Answered By - RavinderSingh13 Answer Checked By - Senaida (WPSolving Volunteer)