I disagree. One of the few things we know about the data is that a matching pair is ordered. Your code does not guarantee that a last fetch precedes its new = 0 counterpart.
Quote:
Originally Posted by in2nix4life
Why change to the current directory? It's already the current directory. Am I missing something?
There is actually a bug in that cd. If the current directory is foo bar, and if there exists a directory named foo, cd $cwd will change to an unintended directory, because the variable expansion isn't double-quoted.
Quote:
Originally Posted by in2nix4life
If there are P patterns, P+1 passes will be necessary. Hopefully it's a small dataset with few patterns. Your approach could be reimplemented to always finish in 2 passes.
Quote:
Originally Posted by in2nix4life
Escaping characters for a regular expression engine is a bug-prone procedure that yields brittle solutions.
A case in point: sed 's#\([]/&[]\)#\\\1#g' will add a backslash before each ampersand. Since ampersands are not an AWK ERE metacharacter, \& is an undefined sequence. An AWK implementation is allowed to either silently ignore the backslash or it can choose to abort or it can do ... whatever it wants.
I prefer to avoid this type of manual escaping as much as possible.
Hi,
By default FIND command searches for matching files in all the subdirectories within the specified path.
Is there a way to restrict FIND command's search path to only the specified directory and NOT TO scan its subdirectories.
Any help would be more than appreciated.
Thanks and Regards (2 Replies)
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Hi,
I want to grep the line which has 'data11'.then from that line, i need to trace back and find out the immediate line which has the same timestamp of that grepped line.
for eg:
log file:
-----------
Process - data
Process - datavalue - 2345
Process - data
Process - data
Process... (9 Replies)
Hi,
I have a command "get_data" with some parameters in few *.text files of a directory. I want to first find those files that contain this command and then append the following parameter to the end of the command.
example of an entry in the file :-
get_data -x -m50 /etc/web/getid
this... (1 Reply)
Hello,
Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line.
i am using string as "testing"
netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h
i am able to get the previous line current line next line but... (1 Reply)
hello All,
i have to two files package.today and package.yesterday , the extension of the files says what day the file belongs to .
contents of the file change little bit everyday .
i am taking only the package and sub package from the files
awk '/^/{print $0}' Packages.today
82 ... (0 Replies)
Dear All,
i want to search particular string and want to replance next line value.
following is the test file.
search string is
tmp,???
,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50
tmp,123 --- if match tmp,??? then... (3 Replies)
Hi All,
I am trying to delete file (with a mtime older than 2 days) from the current directory ONLY using:
find . -daystart -maxdepth 1 -mtime 2 -exec rm {} \;
but this doesn't seem to work it is still find files in subdirectories which I don't want to delete.
Please can anyone offer... (2 Replies)
I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios.
Cat test
Nov 10, 2012 5:17:53 AM
INFO: Request Type
Line 1.... (5 Replies)
hello, all
I have googled internet, read the man page of Find, searched this forum, but still could not figure out how.
My current directory is:
little@wenwen:~$ pwd
/home/little
little@wenwen:~$
I want to use find command to list the files in my current directory, how should i write... (3 Replies)