Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by komark

  1. komark

    How to print between to matching patterns

    Thanks Annihilannic. I have also figured it out and seems quite simple: while (<flist>) { if ( /Tom/../\}/ ) { print; } Thanks, Omar.
  2. komark

    How to print between to matching patterns

    Hi, Suppose I have the following lines in a file: TOM { 1 2 3 4 5 } David { 6 7 8 9 10 } I want to search for TOM and print out all the lines till I get the curly brace. So my output will be: Tom { 1 2 3 4 5 } I can do an awk but when I put that in a perl script I get errors: > awk...
  3. komark

    Search and replace using a specific pattern

    Thanks Annihilannic - it worked.
  4. komark

    Search and replace using a specific pattern

    Hi, I am trying to search and replace in a file. I am trying to look for the word: foo in every line: foo f1 f2 f3..... and replace it with: foo f1 new_word f2 f3... I think i'm close with the following line of code but not quite there yet: $line =~ s/^foo(\s)*/.foo(\s)*new_word/; Thanks...
  5. komark

    how to do multiple inputs into a variable

    Hi, I am trying to input the user input into a variable ex: echo "Please enter the filename:" set file = $< But how can i enter mulitple filenames so the user would input at the prompt: file1 file2 file3 Thanks Omar.
  6. komark

    Foreach w/ wildcards

    I was trying to do this in a script. Change permissions and move to a different directory. Now I have made a list of the actual file list into a different file and ran the foreach command.
  7. komark

    Foreach w/ wildcards

    Thanks for your reply. If i use the double quotes then it doesn't know what to do w/ the asterisk - like if i'm giving part of a file: foreach x ( `cat file` ) foreach? ls -d /home/test/"$x" foreach? end ls: /home/test/abcd*fg: No such file or directory
  8. komark

    Foreach w/ wildcards

    Hi, I have a text file w/ wildcards file1 abcd*fg xy* I am trying to use foreach to read through the file but not successful because of the wildcards. I am doing: >foreach x (`cat file1`) >echo $x >end I get echo: No Match I even used '\' before the asterisk but no luck. Can someone help...
  9. komark

    How to pass arguments

    Hi, I am trying to pass an argument/option in the command line when calling my perl program. The argument/option should call only certain part of my program. Can anyone help me figure this out? Thanks Omar.
  10. komark

    Can't search email thru Personal Folder

    Hi, I am not able to search emails through Personal Folders in Outlook'07. I have Windows indexing and where it says it finished indexing but I still can't search the emails in the pst. I have check the file type pst for indexing and its properties. Can anyone tell me why I can't search...
  11. komark

    If else statement w/ glob

    Find my answer. I had to use this at the top inorder for the glob function to work correctly. use File::Glob ':glob';
  12. komark

    If else statement w/ glob

    Hi, I am not able to get the correct values when I am running this script below. Basically I am putting writing everything in an array into a file 'file.txt'. Then foreach line in the file I am trying to find the file in the directory /home/omar open (DAT, "file.txt"); @newFiles = <DAT>...
  13. komark

    Find a string in a file

    Yes..i'm sorry it is working now. I should have been more specific. Thank you all for the time for helping me.
  14. komark

    Find a string in a file

    Thanks for the reply. I did this: $find = "string"; open FILE, "file.txt"; @line = <FILE>; if ( grep (/$find/, @line)) { $RES = "YES"; } else { $RES = "NO"; } # } print "$RES\n"; close(FILE);
  15. komark

    Find a string in a file

    Hi, I am trying to find a string that matches in a file. Here is the code I have so far: $find = "string"; open FILE, "<file.txt"; while(<FILE>) { if ($_ =~ /$find/) { $RES = "YES"; } else { $RES = "NO"; } } close(FILE); The string is...

Part and Inventory Search

Back
Top