Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to remove the first character from a string?

Status
Not open for further replies.

lutech

Programmer
Jan 25, 2002
16
CA
Which command I can use to remove the first character from a string?

Thanks in advance.
 
one of the ways:

echo "string" | sed -e 's/^.\(.*\)/\1/g' vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
or in ksh [any POSIX compliant]

echo &quot;{myVar#?}&quot; vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Or slightly simpler version of the sed solution

echo &quot;string&quot; | sed 's/^.//' CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top