Print before pattern

Hi all,

i have file some,

$cat file1

1233312/ version 0120
2312/ version 0121

i need print only value before / e.g.

$cat file1
1233312
2312

Thanks you,

sed 's#/.*##' file1

Skip lines without a / :

sed -n 's#/.*##p' file1
1 Like

Hi,
If pattern is just one character, you can use 'cut':

cut -d/ -f1 file

Regards.

pure genio

thank you ,