Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Extracting 3word lines from files

  1. #11
    Junior Member
    Join Date
    Feb 2002
    Posts
    59

    Re:Extracting 3word lines from files

    you are right it does look cleaner that way, however its not producing the desired results. okay here is what i have done to date.

    I have broken it down to three parts.

    Code:
    this command gets me results for all 3 lettered words in file 
     
    grep '^[a-zA-Z][a-zA-Z][a-zA-Z]$' 
     
     
    This command gets me results of all words with 3 characters including the period symbol. 
     
    grep '^U[a-zA-Z|.][a-zA-Z|.]$'  
     
    This command gets me results of all uppercase U's  
     
    grep '^U'
    Now im trying to combine all three of these results together and when i typed in this...

    Code:
    grep '^[a-zA-Z][a-zA-Z][a-zA-Z]$' | grep '^U[a-zA-Z|.][a-zA-Z|.]$' | grep '^U'
    The file starts outputting results however it appears it is hanging now. and looks like it hangs after the third grep in the command.

    hehe maybe im just confusing the korn shell. LOL That is the shell im using.

    Edit for clarification: when i said it appears to be hanging its looks like its outputting only the last grep command and ignoring the first two.

  2. #12
    Mentor
    Join Date
    Jun 2001
    Posts
    1,672

    Re:Extracting 3word lines from files

    Ok I'm confused. What exactly are you trying do here? ???

  3. #13
    Junior Member
    Join Date
    Feb 2002
    Posts
    59

    Re:Extracting 3word lines from files

    [quote author=cloverm link=board=10;threadid=4337;start=0#43236 date=1027713593]
    Ok I'm confused. What exactly are you trying do here? ???
    [/quote]

    don't worry im just as confused, question is....

    Find all the words in /home/path/filename that have only 3 characters and start with a "U" (uppercase U)

    So what im gonna do cuz all this has to go to a file im just gonna do them indivually and append them to the file instead, and see what is said.

    But a new problem cropped up. I can't remove dirs or my files that i messed up. So have emailed them to see why. I have chmoded till im blue in the face and no go...this is agrivating, Im tired of the datamanagement aspects of this, last half will be scripts and MUCH FUNNER!!!

    Edit: Im so glad im STUBBORN!!! just got my directories and files fixed. hehehehe

  4. #14
    Mentor
    Join Date
    Jun 2001
    Posts
    1,672

    Re:Extracting 3word lines from files

    [quote author=NeoStarO1 link=board=10;threadid=4337;start=#43238 date=1027714665]

    Find all the words in /home/path/filename that have only 3 characters and start with a "U" (uppercase U)

    [/quote]

    This will work if you have one word per line.

    Code:
    grep '^U..$' /home/path/filename

  5. #15
    Junior Member
    Join Date
    Feb 2002
    Posts
    59

    Re:Extracting 3word lines from files

    So it appears that im reading the question wrong. So it only wants words that have a total of 3 characters and start wtih the letter U (uppercase)

    Hmmm maybe that was my problem, I thought it meant ALL words that have 3 characters and also Words that start with uppercase U.

    Well I'll go with your advise.

    I sure have learned alot about grep for sure. I can see where it can be very usefull.

Similar Threads

  1. Word 2003 will not open .doc files
    By Pat in forum Windows - General Topics
    Replies: 0
    Last Post: 03-31-2006, 11:06 PM
  2. Creating Visio Drawings from Text Files
    By The Donald in forum Windows - General Topics
    Replies: 0
    Last Post: 01-05-2005, 06:24 AM
  3. OneNote 2003 temporary files may stay
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 02:48 AM
  4. Files and Settings Transfer Wizard
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 12-31-2004, 10:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •