- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: pattern match
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 10:28 AM
09-30-2004 10:28 AM
pattern match
I have a file like:
abc
def
ghi
dhkhfk
hdfklhfl
hflhflf
nlltln
hlorn;f
nlahflh
b,xbx
nn.vn
nflhfl
ahff
jhflk
I need to grep for all the occurances for
Can anyone please help me to do this.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 11:15 AM
09-30-2004 11:15 AM
Re: pattern match
If each time the
Hope this helps, Bye.
Francis.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 12:00 PM
09-30-2004 12:00 PM
Re: pattern match
The number of line after
Can you please let me know how to do it.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 12:25 PM
09-30-2004 12:25 PM
Re: pattern match
Not a great script. As long as the ID stuff looks like
grep "
do
FILE=$(echo "$i" |sed -e 's/>//g' -e 's/echo $FILE
sed -n -e '/
done
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 12:27 PM
09-30-2004 12:27 PM
Re: pattern match
do
sed -n "/\
done
Better scripters are around. but hey, it works :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 02:44 PM
09-30-2004 02:44 PM
Re: pattern match
#!/usr/bin/perl
open(FH, "< file") or die "$!";
# Slurp the whole file
undef $/;
$file =
# Separate file into chunks starting with
@chunks = split(/(?=\
for $chunk (@chunks) {
# For each chunk extract its ID number and lines that follow
($id, $chunk) = ($chunk =~ /^\
# Append each chunk into a file called chunk_
open(CHUNK, ">> chunk_${id}.txt") or die "$!";
print CHUNK "$chunk";
close(CHUNK);
}
close(FH);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2004 05:23 PM
09-30-2004 05:23 PM
Re: pattern match
script
so that it will create inputfilename.
every file contains in between patterns of
#!/usr/bin/sh
index=0
# input file
testfile=$1
fun()
{
# Line
ln="$1"
if [[ $( echo $ln | grep '
then
echo $ln >> $testfile.$index
else
let index=index+1
fi
}
# main loop
while read line; do
fun $line
done < $testfile
# exit
exit 0
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2004 01:56 AM
10-01-2004 01:56 AM
Re: pattern match
"
Check out using XML::Twig module of perl