10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I would like to be able to use a regular expression to find and replace entire strings, but not replace if the string is a substring in a larger string.
Example:
$string = "ABC ABCDEF ABC ABCDEF ABC";
Something like - $string =~ s/ABC/XYZ/g;
->Desired:
$string = "XYZ ABCDEF XYZ ABCDEF... (3 Replies)
Discussion started by: rjulich
3 Replies
2. Shell Programming and Scripting
Hi,
I have 2 different templates of sql's in a single file. From each sql I am trying to extract different segments of the sql's.
Please note that the number of fields and conditions would vary based on the sql. It might not adhere to a single format as below(but will adhere to allowable sql... (4 Replies)
Discussion started by: hitmansilentass
4 Replies
3. Shell Programming and Scripting
Hi,
temp="/usr=25,/usr/lib=12"
How to get only dir names with out values.
I tried like below but no use.
tmp=${temp##*,}
echo $tmp
o/p:
/usr/lib=12
expected o/p:
/usr /usr/lib ---> in array (13 Replies)
Discussion started by: munna_dude
13 Replies
4. Programming
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
Discussion started by: jessy83
1 Replies
5. Shell Programming and Scripting
Hello,
Awk seem treat the pattern as regular expression, how can awk search not using regular expression? e.g. just represent for "", not "A" or "a" . I don't want to add backslash . (2 Replies)
Discussion started by: 915086731
2 Replies
6. Shell Programming and Scripting
Hi,
I am new to scripting.
please help me in validating the user entered time Pattern
Here is the program
#!/bin/bash
validateTimeFormat()
{
checkTime=$1
timePattern="::"
if ]
then
echo "Valid time pattern"
return 1
else
echo "InValid time pattern"
return -1
fi
}
echo "Please... (2 Replies)
Discussion started by: vvenu88
2 Replies
7. Shell Programming and Scripting
Hi,
i am java guy and new to unix.
I want to validate date pattern using Regex expression
here is the sample program i have written.
#!/bin/sh
checkDate="2010-04-09"
regex="\\d{4}-\\d{2}-\\d{2}\$"
echo $regex
if ]
then
echo "OK"
else
echo "not OK"
fi
But the ouput is... (2 Replies)
Discussion started by: vvenu88
2 Replies
8. Shell Programming and Scripting
Hi All,
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
$day=091023;
$day_combine = $day;
$day_combine =~ s/({2})({2})({2})/20$1-$months-$3/;
Instead of three lines, is possible to combine the last two lines into a single line? means no need assign $day to $day_combine... (2 Replies)
Discussion started by: jimmy_y
2 Replies
9. Shell Programming and Scripting
Hi guys,
as per subject I am having problem with regular expressions.
Example, if i got a string "javax.servlet.http.HttpServlet.service" that may occurred anywhere within a text file.
How can I used the negate pattern matching of regular expression?
I tried the below pattern but it... (4 Replies)
Discussion started by: DrivesMeCrazy
4 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I'm struggling with a regex that would match a 'b' that follows an 'a' and is at the end of a string of non-white characters. For example:
Line 1: aba abab b abb aab bab baa
I can find the right strings but I'm lacking knowledge of how to "discard" the bits that precede bs.... (2 Replies)
Discussion started by: machinogodzilla
2 Replies