Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
sed 's/.\(.*\)/\1/' myfile

Say myfile contains:


I want to remove the first character only from the first line but the above removes it from all the line.

share|improve this question
up vote 9 down vote accepted

Maybe sed '1s/.\(.*\)/\1/' myfile?

share|improve this answer
thank you very much – munish Feb 24 '12 at 5:57
Capturing groups slows down the regular expressions. Better do it without them: sed '1s/.//' myfile. – manatwork Feb 24 '12 at 15:35

can also use awk: awk 'NR==1 {sub(/./,"")} 1'

share|improve this answer

tail can read from a byte offset, so if your file uses only single-byte characters (typically UTF-8 ASCII), this will work.

It depends on your situaton, whether it is improtant to you or not, but tail is faster than sed... probably becaue sed needs to process each line inndividually, ... But don't use it where there is any chance of the first character using more than one byte.

tail -c +2 "file"  

From man tail

-c, --bytes=N output the last N bytes; alternatively, use +N to output bytes starting with the Nth of each file

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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