Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: find string in file

by hipowls (Curate)
on Mar 31, 2008 at 09:50 UTC ( #677485=note: print w/replies, xml ) Need Help??

in reply to find string in file

perl -ne'print if /Version +=/' file_name

perl -ne'print if /Version\s*=/' file_name

Updated: Thanks for the corrections;-)

Replies are listed 'Best First'.
Re^2: find string in file
by CountZero (Bishop) on Mar 31, 2008 at 10:06 UTC
    perl -ne'print if /Version\s+=/' file_name
    The character class \s contains all forms of whitespace (such as tabs, ...).


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      ... and both of you failed to notice that "0 or more" translates to *, not + ;-).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://677485]
[choroba]: I've moved away from nvidia
[davido]: I have nvidia (1050ti) in one system at home. My work laptop came with a radeon/amd video system that is no longer supported by debian/ubuntu. So that being the case I'm in the "prefer nvidia even if proprietary" camp
[davido]: Especially since the laptop is only a couple years old.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2017-05-26 14:24 GMT
Find Nodes?
    Voting Booth?