dnax86:
I don't understand what you talk about in your 1st qyestion, do you talk about the FTP protocol?
>Do you see some characters like ^M in vi?
I did't edited the script with VI, I used XCODE and text editor (Mac OS X software)
But when I edited the script with VI....
YES I see ^M characters.
What does it mean?
If you transfer a file in binary mode it also copies the hex x0D characters at the end of the lines.
In DOS/Windows text files a line ends with CR/LF while on *nix systems a line ends with a LF (hex 0A).
You can converse the file if you have the utility dos2ux on your system.
An alternative is:
tr -d \\r < win.txt > unix.txt
Regards
joeyg
February 23, 2008, 9:58am
22
I will have to think about the following:
sed 's/$pattern_da_cercare/$pattern_da_cercare \n/g' $zf >tempf
This is now a sed issue on inserting a line feed to force a new line
if pattern="smith"
...it should replace
with
prior to the
numpat=$(cat tempf | grep "$pattern_da_cercare" | wc -l)
DNAx86
February 23, 2008, 3:20pm
23
joeyg:
I will have to think about the following:
sed 's/$pattern_da_cercare/$pattern_da_cercare \n/g' $zf >tempf
This is now a sed issue on inserting a line feed to force a new line
if pattern="smith"
...it should replace
with
prior to the
numpat=$(cat tempf | grep "$pattern_da_cercare" | wc -l)
So, what changes I have to do to make the script work?
joeyg
February 24, 2008, 8:56pm
24
sed 's/$pattern_da_cercare/$pattern_da_cercare \n/g' $zf >tempf
That command is not inserting a blank line after each $pattern_da_cercare as I thought it should.
Try to research into sed to insert a blank line.
DNAx86
March 12, 2008, 5:48am
25
joeyg:
sed 's/$pattern_da_cercare/$pattern_da_cercare \n/g' $zf >tempf
That command is not inserting a blank line after each $pattern_da_cercare as I thought it should.
Try to research into sed to insert a blank line.
I tryed to research how to insert into sed a blanck line but I wasn't succeed.
Doe anyone know how to do it?
I got lost going through this thread. But the final question seems to be:
$ echo "abc abc abc" | sed 's/abc/abc\
> /g'
abc
abc
abc
$
The backslash is the thing on the first line so sed sees a backslash newline. I need a "g" at the end of sed s command to operate on all occurences of "abc".
or use tr to ceate a list with one word per line, then the grep to count:
e.g.
tr -cs "[:alpha:]" "[\n*]" < infile | grep -cw searchstring