Operating System - HP-UX
1825954 Members
2516 Online
109690 Solutions
New Discussion

Re: Scripting - Delete characters

 
SOLVED
Go to solution
Krish_4
Contributor

Scripting - Delete characters

Hi,

I want to delete letters between , and :. For example, ZDm1dl1Wy6sRg,7/hQ: . Between , and : there may special characters,alphanumeric etc..
The pattern is not same in all the lines. Is it possible to acheive this using sed or awk?

Thanks.
5 REPLIES 5
RAC_1
Honored Contributor
Solution

Re: Scripting - Delete characters

cat "your_file" | sed 's/,.*://g'

Anil
There is no substitute to HARDWORK
Biswajit Tripathy
Honored Contributor

Re: Scripting - Delete characters

str="ZDm1dl1Wy6sRg,7/hQ:
echo $str | sed 's/,.*://g'

Read str from your input file.

- Biswajit
:-)
Biswajit Tripathy
Honored Contributor

Re: Scripting - Delete characters

Anil,
You beat me to that :-)
- Biswajit
:-)
RAC_1
Honored Contributor

Re: Scripting - Delete characters

BY 4 mins, 19 secs
There is no substitute to HARDWORK
Biswajit Tripathy
Honored Contributor

Re: Scripting - Delete characters

RAC wrote:
> BY 4 mins, 19 secs

Yup... things move a lot slower in friday afternoon.
I need a coffee...

Everybody,
Sorry for the stroll :-)

- Biswajit
:-)