Summary: Do you need to delete the lines that include the patterns or just the lines inbetween? This perl command will do an inline edit of your file and dele...
Summary: Ken: I'd use a pattern matching language like perl or awk: # use nawk on Solaris nawk ' { /computer/ $3=400 print $0 } ' file Regards, Nails...
Summary: I'm using grep to search for a string in a text file once i've found a match what i really want to do is substitute the line above the match. How wou...
Summary: Hi All, I need help regarding file name pattern. AMK_MFG_RFP_210404.TAB TJ_MFG_RFP_210404.TAB JAGUARIUNA_BR_MFG_RFP_210404.TAB FORT_WORTH_TX_CFC_RFP_2...
Summary: Yeah James ... it works fine ... thanx a bunch ... when the sql statements are placed with no gaps between them, multiple sql statements get treated ...
Summary: Get a copy of "The New Kornshell" by Morris I. Bolsky and David G. Korn. On page 276 is a version of the grep command written in Kornshell. You can ...
Summary: I have a file with the following sample format. "USEXPRR abc def" "USEXPDD ghi jkl" I am pattern matching the first field to assign the value of the f...
Summary: OK, this will come closer to what you need. Lines are sorted by # fields on the line (most to least). Each line that is NOT a subset line is writt...
Summary: Jerry: In the bash shell, for a script like yours to work, the extended pattern matching has to be turned on. Place the following line in your script...
Summary: If you are calling sed every time through the loop, there is no way it is more efficient. If you are doing a global change to a file, sed is the util...
Summary: Hi: IMO, sed is not the best solution for this problem. Most unix variants supply the dirname command: #!/bin/ksh while read str do dirname $str do...
Summary: If it works for your version of grep the -A and -B flags specify lines before and after a pattern match. You can also do it with sed sed -n -e '/regex...
Summary: Thanks, but it is not working with the '*' in there. When I mention the exact file name, it works, but pattern matching did not work. Any other ideas...
Summary: find allows the use of regex. Do a man on regex to find out more about pattern matching. Also the -i flag to grep makes it case insensitive. find . -n...
Summary: Here are two sed solutions and one awk solution. Of course, sed and awk both can identify the line prior using pattern match instead of exact match....
Summary: Using sed, how can I delete the lastline if it matches a certain pattern? I know I can delete the last line regardless of a pattern match with $d, but...
Summary: Hi, I am trying to do the following simple operation with sed, but it wouldnt work because sed doesn't allow me to use variables in the replace string...
Summary: The ${var#pat} and ${var%pat} constructs do not recognize begin-of-line and end-of-line anchors because their logic is already targeted to either the ...
Summary: Looks like a little problem here: For the value var=er_non_pstn_output.csv expr "$line":".*non_pstn" pattern matches very well.Which is fine. But w...
Summary: /usr/xpg4/bin/grep -E '[A-Z]{2,}' infile.txt This will match words starting with two or more capitals. man regex for more pattern matching details. O...
Summary: The shell is essentially a command interpreter. It possesses pattern matching ability along with some limited integer math functionality. However, i...
Summary: i'm like in awe of Jean-Pierre's solution. I had to man, info and browse to understand it. i'd like to try to explain so I will really learn it. The ...
Summary: Use the external basename command or if you are using ksh or bash, use the pattern matching construct: #!/bin/ksh # method 1 v=`pwd` v=`basename $v` e...