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...
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...
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.
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.
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
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...
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.
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...
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>...
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...
Hi,
I am doing a grep to get:
a,b,c,d
and I trying to pipe sed command to make it look like
a
b
c
d
I am not having any success
sed 's/,/\r/g'
Thanks in advance
Omar.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.