0

Input example:

foobar_1-1 1024 x 1024

Desired output

foobar_1-1

The hyphen is causing issues here. It's causing the output to be two items in the array:

foobar_1, 1

Any advice?

1
  • 2
    Please share your full SED command.
    – Malik
    Commented Mar 17, 2022 at 7:52

1 Answer 1

0

sed by default doesn't do that, it's a problem in your sed command.

if you want to manipulate strings like your example you can also use awk:

$ echo 'foobar_1-1     1024 x 1024' | awk -- '{ print $1 }'
foobar_1-1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .