Sponsored Content
Top Forums Shell Programming and Scripting How to get value between patterns Post 302300622 by sirababu on Tuesday 24th of March 2009 03:10:56 PM
Old 03-24-2009
Quote:
Originally Posted by radoulov
Code:
perl -nle'print join" ",m|<[^>]*>([^<]*)</[^>]*>|g' infile


Works Perfect, anything in sed or awk?, just curious

Last edited by sirababu; 03-24-2009 at 06:24 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

3 patterns in one line

hello, I want to write a script to find all the files that contain 3 specific patterns. example: shows the files containing any line that contain pattern1, pattern2 and pattern3, but the patterns can be in any order as long as they exist in the line. can I do that with grep? thank you (1 Reply)
Discussion started by: bashuser
1 Replies

2. Shell Programming and Scripting

get the value between 2 patterns

hello experts, I want to get the value between 2 patterns. ex. get hello in <line>hello</line> Any suggestions? any sed, grek, awk commands? (11 Replies)
Discussion started by: minifish
11 Replies

3. Shell Programming and Scripting

Searching patterns in 1 file and deleting all lines with those patterns in 2nd file

Hi Gurus, I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies

4. Shell Programming and Scripting

need help in string patterns

Hi, i have a directory /u02.i have 2 files in it like abc1.gz abc2.gz i want to store file pattern in a variable like f1="abc?" i don't want to take .gz in variable rather i want .gz appended when i need to unzip the file like gunzip $f1 Can you please help me how to... (3 Replies)
Discussion started by: malikshahid85
3 Replies

5. Shell Programming and Scripting

need help in string patterns

Hi, i have following lines of code which is properly working. CAT1="${InputFile}CAT_*0?????" CAT2="${InputFile}CAT_*0?????" CountRecords(){ integer i=1 while ]; do print P$i `nawk 'END {print NR}' $1 ` >> ${OutputPath}result.txt & i=i+1 shift done } CountRecords "$CAT1"... (8 Replies)
Discussion started by: malikshahid85
8 Replies

6. Shell Programming and Scripting

grep value between two patterns

Hi All, I've been trying solve this with a simple command but not having much luck. I have a file like this: Line 1: random_description 123/alert/high random_description2 356/alert/slow Line 2: random_description3 654/alert/medium Line 3: random_description4 234/alert/critical I'm... (7 Replies)
Discussion started by: joe19
7 Replies

7. UNIX for Dummies Questions & Answers

counting_word_excluding patterns

Hi everyone, I am new to this forum. So I apologize if my question is too basic. I am trying to find the amount of words I have in a large number of XML files. Of course I do not want to count XML tags (<.*?>). But i do not know how to do it .:wall: Is there an easy way? (By the way I am working... (7 Replies)
Discussion started by: mcptrad
7 Replies

8. Shell Programming and Scripting

bash many patterns

hi guys in my bash script I call wget to check for valid links like this: wget -q "$1" -O- | grep -ow "href=\"http://*\"" | sed -e 's/href=//g' -e 's/"//g' but this only finds the urls starting with http.What if I also want to find the urls starting with Https and https? (2 Replies)
Discussion started by: vlm
2 Replies

9. Shell Programming and Scripting

Find matched patterns and print them with other patterns not the whole line

Hi, I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
Discussion started by: redse171
3 Replies

10. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
case(n) 						       Tcl Built-In Commands							   case(n)

__________________________________________________________________________________________________________________________________________________

NAME
case - Evaluate one of several scripts, depending on a given value SYNOPSIS
case string ?in? patList body ?patList body ...? case string ?in? {patList body ?patList body ...?} _________________________________________________________________ DESCRIPTION
Note: the case command is obsolete and is supported only for backward compatibility. At some point in the future it may be removed entirely. You should use the switch command instead. The case command matches string against each of the patList arguments in order. Each patList argument is a list of one or more patterns. If any of these patterns matches string then case evaluates the following body argument by passing it recursively to the Tcl interpreter and returns the result of that evaluation. Each patList argument consists of a single pattern or list of patterns. Each pattern may con- tain any of the wild-cards described under string match. If a patList argument is default, the corresponding body will be evaluated if no patList matches string. If no patList argument matches string and no default is given, then the case command returns an empty string. Two syntaxes are provided for the patList and body arguments. The first uses a separate argument for each of the patterns and commands; this form is convenient if substitutions are desired on some of the patterns or commands. The second form places all of the patterns and commands together into a single argument; the argument must have proper list structure, with the elements of the list being the patterns and commands. The second form makes it easy to construct multi-line case commands, since the braces around the whole list make it unneces- sary to include a backslash at the end of each line. Since the patList arguments are in braces in the second form, no command or variable substitutions are performed on them; this makes the behavior of the second form different than the first form in some cases. SEE ALSO
switch(n) KEYWORDS
case, match, regular expression Tcl 7.0 case(n)
All times are GMT -4. The time now is 02:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy