How to get a specific word in a file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coaxfiber
    New Member
    • Mar 2007
    • 60

    #16
    Originally posted by marimuthup
    with awk or grep how would I get a specific word in a file, rather than a lin.

    For example:

    File contains lines such as

    This is MyTime:00:0450 Secs

    I wanna to extract the String where it is between 'MyTime:' and Secs, where I need only the String '00:0450' printed.

    Definelty not the entire row.

    Could some one help me?

    Hi,


    Try this one assuming line 'MyTime:00:0450 Secs' is fix and only the numbers are varying,


    cut -c 8-14 file.txt

    FYI.

    -coax

    Comment

    Working...