I guess I live in another timezone and when work is over, I go home and usually don't look into here anymore. That's why I didn't answer that fast Can you post the pm question here please? I will describe the syntax soon as edit in this post here.
EDIT:
s = substitution
/ = start of the pattern
. = any character
* = zero or as many of the former character
\( = escaped starting bracket of the group I want to extract
[ = starting squared bracket of a group of characters
^ = inside the squared bracket means "not/none" of the following, in this case as long as no > shows up
] = ending the group
* = zero or as many of the former character, in this case as many as it is no >
\) = escaped bracket to end the group definition
\/ = just escaping the slash of that end tag
.* = zero or as many of any character (you know that by know already )
/ = here ends the pattern I want to find and starts that, through what I want to substitute
\1 = print out the 1st group I defined inside the \( \) escaped curled brackets
/ = end of the substitution input
g = globally, do it on the whole line of input
Best search the web for sites that explain regular expressions (reg exp) or get that nice awk&sed book from O'Reilly which is worth it, the small reference book and/or the "bigger" one.
Thanks a lot Zaxxon ... that post really helped me a lot ... however if the file is a huge file then it is taking a lot of time to get executed.
I'll tell you exactly what I am tryin to do:
I need to get the value in between the tags <TAG></TAG1>.
Then I need to count the number of some other tag. So the situation here is:
sed 's/.*<L:TAG>\([^>]*\)<\/L:TAG>.*/\1/' $hugefile
So this is reading the whole file in spite of removin the g at the end!!!
Then I have got this line to count the number of the other tags which is again reading the entire file!
otherTagCount=`egrep -hc -e $searchString $line | awk '{sum+=$1};END{print sum}'`
I have got the above line 4 times to count different tags.
So it is taking double time to execute the script.
Thanks in advance!!!
Hello,
I have a problem with the /etc/rc.d/init.d script to automatically update STEAM GAME ARK. I've converted 3 scripts into one, but something does not work correctly ...
The problem is in the file latestavailableupdate.txt / line 36/39. It think the problem is with script, it wrongly... (2 Replies)
Hi,
I have a SQL script with "create table" and "alter table" statements and I want to cut all the alter table statements from original file (A) and move it to a different file (B).
Can you please me the option. Thanks a lot for your time. (3 Replies)
This is my command-line code in my script,
passwd=`grep $passwd $userfile | cut -f2 -d: login_users > retrieve`
the
cut -f2 -d: login_users > retrieve
searches and prints the whole column two. what I need is one of the items in the column two only.. what option can I add to my cut... (2 Replies)
not sure how to do it. wan't to delete it using cut and grep ince i would use it in the shell.
but how must the command be?
grep "64.233.181.103 wwwGoogle.com" /etc/hosts | cut -d
the delimeter is just a space. can you help meplease. :D (1 Reply)
The script is following :
for each_rec in <file_name>
do
count=`cut -c -2 ${each_rec} | grep "45"`
echo ${count}
if ] then
amount=`cut -c 24-35 ${each_rec}`
echo ${amount}
else
echo "failed"
fi
done
And the file looks like below :
... (4 Replies)
hi people,
I have a text file containing data, seperated by TAB. I want to process this tab'ed data as variable. how can I assign this?
Ex:
11aaa 12000 13aaa 14aaa 15aaa 16aaa 17aaa
21aaa 22000 23aaa 24aaa 25aaa 26aaa 27aaa
31aaa 32000 33aaa 34aaa 35aaa 36aaa 37aaa
41aaa 42000 43aaa... (5 Replies)
Hello all,
I have some weird problem that kinda baffles me. Say I have the following test file:
claudia:~/tmp$ cat testfile.txt
This is a test line
This is the second test line
And yeah, this is the third test line
Then say I want to tail the file, grep for the word "third" then... (7 Replies)
Hi
Is there a way to cut the last two characters off a word or number given that this word or number can be of varying length?
I have tried something like
TEST=`echo $OLD | cut -c 1-5`
where $OLD is a variable containing a number like 1234567 which gives a result of 12345. This is fine... (4 Replies)
hi,
i have a simple question:
in hpux 11i;
this cmd :
cat mailtest |grep sekar >test1
gives the output file with the name test1.
i want to remove the line which contains the "sekar" and put the result in the new file....
what is the command for that?.. (2 Replies)