Hi,
Could any one of you let me know any simple Unix command for deleting first 10 letters of first line in unix?
Eg: 123456789ABC --Input
ABC--Output
Thanks
Sue
Hi,
Could any one of you let me know any simple Unix command for deleting first 10 letters of first line in unix?
Eg: 123456789ABC --Input
ABC--Output
Thanks
Sue
You mean CB? (1-9 is 9 chars, not 10)
echo "123456789ABC" | sed 's/^..........//'
Hi,
Thank you. It worked when i use the code provided by you. Suppose if i need to use that code for a file and if i want to replace the input file with the first 10 letters removed, how can i do that?
Thanks
Sue
sed 's/^..........//' inputfile > newfile
Hi,
If i do like that, i am getting an output file with 0 bytes.
Please adivice me what can be done to resolve this.
Thanks
Sue
Hmm, but that is not very flexible, imagine the next problem being to remove the first 43 characters. How about:
echo "123456789ABC" | cut -c11-
Hi,
The following command gave me the correct results:
cut -c39- In_Put.txt > Out_Put.txt
Thanks Once again,
Sue
My output is:
-----------------------------
Now run:
My output is:
in testB
For deleting first n number of chars, instead of writing 'n' dots(.), following pattern can be used -
^.\{n\}
so the sed can be changed to
cat testA |sed 's/^.\{n\}//' > testB
if you want to change all the file name as u required then this might help u
ls | while read file
do
file_req=`echo ${file} | sed 's/^.\{n\}//' `
mv ${file} ${file_req}
done