sed - delete until char x

Hi,

I got a Textfile contains hundreds of lines like this:

3 02 8293820 0 22 22

All I need is this:

293820 0 22 22

So i decided to delete until the first '8' comes up. But how I can realize that?

Use cut:

cut -c 7- file > newfile

Regards

The only pattern I can use is the _first_ 8. The lines differ in the number of whitespaces, chars before the first 8 etc.

If I got it right, you want to cut off all digits until the first "8" shows up, including itself?:

sed -n 's/[^8]*8//p'

Yes, thats right. Works perfect. Thanks a lot!

Now Ive a new problem. Cut off all chars until the first "$" shows up, inc itself.
I tested: sed -n 's/[^\$]*\$//p', but didnt work, what ive to do in this case?

thanks in advance

sed -n 's/[^$]*\$//p'

Argh,

this was my testcase: echo "430 s 0$02s02" | sed -n 's/[^\$]*\$//p'
Just a minute ago I realized: echo "430 s 0\$02s02" is the answer... :slight_smile:

I've a last question. :wink:

How can I delete all chars until a digit (0-9) shows up, but EXLCUDING itself?

sed 's/\([^0-9]*\)\(.*\)/\2/g' file