Member Avatar for spinachio

I have a text file that looks like

Y07976.1/124-271
Y07978.1/48-201

and I want to remove everything after the forward slash such that in the end the text file will look like

Y07976.1
Y07978.1

I am currently learning perl and I think regular expressions are going to be a trouble for awhile but I thought about using

$line=~ s/\W.*//;

but that removes everything after the "." and I want to keep the ".1". I appreciate any help.

Thanks

Recommended Answers

All 2 Replies

s/\/.*$//
Member Avatar for spinachio
s/\/.*$//

thank you -- thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.