[Solved] Sed is doing my head in! How do you remove the first character of a string?
Hello!
Please bare with me, I'm a total newbie to scripting. Here's the sudo code of what I'm trying to do:
Currently I have:
with the s variable being the user input which looks like "test001" or "testtwo010"
As you can see I'm having trouble with the sed that will chop of the first character.
I tried :
but that will print the last 2 characters but not chop off the first.
Ive also tried hacking as sed with
but that just gets me an error
Thanks!
Katie
---------- Post updated at 10:59 AM ---------- Previous update was at 10:16 AM ----------
fixed it, Thanks, and sorry for clogging up your threads!
If anyone is interested the solution is:
Moderator's Comments:
Yes - We are always...
Last edited by vbe; 09-22-2010 at 07:15 AM..
Reason: code tags please
Hi
I have file in below format. How i can remove the first and lost comma from this below file
,001E:001F,,,02EE,0FED:0FEF,
I need output has below
001E:001F,,,02EE,0FED:0FEF (6 Replies)
hello !
I have to remove string between a number and set of characters. For example,
35818 -stress - - -stress - - - - - - DB-3754
44412 caul kid notify DB-3747
54432 roberto -, notify DB-3725
55522 aws _ _int _ _classified 2_a _a 2_m _m 2_classified 2_search... (7 Replies)
Hi,
Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank.
Text file :
"1"|"ExternalClassDEA519CF5"|"Art1"
"2"|"ExternalClass563EA516C"|"Art3"
"3"|"ExternalClass305ED16B8"|"Art9"
...
...
... (2 Replies)
Hi
I need help on this ..!!
Input :
xx_abc_regA
xx_def_regB
xx_qwe_regC
Now i required the output as the below
abc
def
qwe
Need to remove last occurrence of character (_) and rest of the string in Unix (sed).
Thanks in Advance ..!!!
-Nallachand (3 Replies)
Hi All,
I have output like this below
ldprod/03
ldprod/02
ldprod/01
ldprod/00
ldnprod/
ldnprod/030
I want only remove all character including /
ldprod
ldprod
ldprod
ldprod
ldprod
ldnprod (8 Replies)
In bash, how can one remove the last character of a string? In perl, the chop function would remove the last character. However, I do not know how to do the same job in bash.
Many thanks in advance. (12 Replies)
How can i remove the first and last character of strings like below:
"^^^613*"
"admt130"
"^^^613*"
"123456"
"adg8484"
"DQitYV09dh1C"
Means i wanna remove the quotes("").
Please help (17 Replies)
Hi there,
i need some help to remove all occurrences of a certain character at the beginning of a string.
Example: my string is 00102030 and i want to remove all zeros from beginning of string so the result is 102030 (3 Replies)
Hi all,
Does anyone know how to code in ksh that will remove the first character in a string variable and replace that variable without the first character?
Example:
var1=ktest1 will become var1=test1
var2=rtest2 will become var2=test2
Need help please. (10 Replies)