Hello Everybody, I am trying to run a simple script to monitor a log file, where I need to send an alarm every time specific line is being written into this log file, currently my script is working fine, the problem is with the miltiple lines that is being written whenever I have a problem with my SW and many lines are logged into this log file which is causing many alarms to be sent, so I am seeking a way to trigger sending the alarm only one time but without existing this script, I need my script to keep …

Member Avatar
Member Avatar
+0 forum 4

I want to find common line in two files and replace the next line of first file with the next line of second file. (sed,awk,perl,bash any solution is welcomed ) Case Ignored. Multiple Occurrence of same line. File 1: hgacdavd sndm,ACNMSDC msgid "Rome" msgstr "" kgcksdcgfkdsb msgid "" hsdvchgsdvc msgstr "" dhshfjksdfhmd msgid "Vidya" msgstr "" sdjhcbnd dcndnv cfnkdndvrknvkf dfkvrnkdfnk snfvrkng msgid "Rome" msgstr "" wdbhkjbcfj #dmcdmf f,nvdf, fvnfnvk vfmf,mv vfn msgid "vid" msgstr "" dmcbdmbcvmfbvmkhsdk file 2: dfhkvgjbfrvkf msgid "Rome" msgstr "new bie" sdbsjbcdcbwoido fjcdcvnm msgid "vidya" msgstr "expert" dvnjfkdvhnkfvnknsbdjh msgid "vid" msgstr "newton" dfenfjdbrfjbvlfnvl dcnkncvkdfvknfv fcndkbvknfkv vfdnkvnfknbvkfn Later …

Member Avatar
Member Avatar
+0 forum 2

I'm just trying to figure out how to get everything after the first two words in a line. Right now, I've got the opposite - the first two words themself: ^(\S+ \S+) I want the opposite of this. Thanks!

Member Avatar
Member Avatar
+0 forum 2

Hi Can anyone explain me the following command. This may be a minor one, but, please do explain in detail. CHKTRANS=`echo ${0} | grep '/transforms/' | wc -l`

Member Avatar
Member Avatar
+0 forum 10

When using the Grep command to find a search string in a set of files, is there a way to dump the results to a text file? Also is there a switch for the Grep command that provides cleaner results for better readability, such as a line feed between each entry? Perhaps there is a Grep script that outputs cleaner results Thanks

Member Avatar
Member Avatar
+0 forum 4

Hi, I have a HTML page in one variable. I need build a mehod that will extract a tag content (dif extract_tag(self, tag_name)). For example, given webpage: <div id="mw-page-base" class="noprint"></div> <div id="mw-head-base" class="noprint"></div> <!-- content --> <div id="content" class="mw-body"> <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><!-- centralNotice loads here --></div> <!-- /sitenotice --> <!-- firstHeading --> <h1 id="firstHeading" class="firstHeading"><span dir="auto">Earth</span></h1> </div> and tag named: "content" the method should return <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><!-- centralNotice loads here --></div> <!-- /sitenotice --> <!-- firstHeading --> <h1 id="firstHeading" class="firstHeading"><span dir="auto">Earth</span></h1> I want to do …

Member Avatar
Member Avatar
+0 forum 1

Hi i want to grep for two different patterns in the same file and diff the results(without needing to store them) I amnot able to get diff to accept the output of the two greps as arguments. Any help? Thanks for your time.

Member Avatar
Member Avatar
+0 forum 1

After running the command [CODE] find . -name "R*VER" -mtime +1 -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \;[/CODE] my files look like this [CODE] RRR1~COS~COSMETICS~40048~jgmdtv113~1~P~R22-200~029053662549~20110607~102151.VER No error RRR1~COS~COSMETICS~ETT03~jgm14652.~3~F~R16-500~000907009757~20110607~085109.VER err 3922 [/CODE] Using the tilde (~) symbol as delimiter in the file name, can I extract the fields I want so I get an output like this [CODE] RRR1~COS~COSMETICS~40048~jgmdtv113~1~P~R22-200~029053662549~20110607~102151.VER No error RRR1 COS P RRR1~COS~COSMETICS~ETT03~jgm14652.~3~F~R16-500~000907009757~20110607~085109.VER err 3922 RRR1 COS F [/CODE] I tried the following [CODE] find . -name "R*VER" -mtime +1 -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \;|awk -F~ '{print …

Member Avatar
Member Avatar
+0 forum 4

Hi, I have a folder containing a further 2500 folders or so. These all contain files. I want to move the files from within only a selection of around 260 of these folders into a new folder. I have a text list of the folders of interest. So basically I want to open the folders named in my list, move only the files from these folders and consolidate together into one new folder. I'm looking at grep etc but I don't know how to implement this on folder names within a directory. Any pointers on where I could start on …

Member Avatar
Member Avatar
+0 forum 1

This is inspired for recent poster, who asked to check multiple strings in multiple files.

Member Avatar
Member Avatar
+0 forum 1

I am supposed to find a file recursively in a given directory. Rules are not to use find and recursive options like ls -R and grep -r. I can any other other option expect recursive. I had written the script using recursion. [CODE]#!/bin/csh foreach i (`ls -R $1 | grep : | sed 's/://'`) readlink -f "$i/$2" end[/CODE] Please help me solve this. It is quite urgent. Thanx

Member Avatar
Member Avatar
+0 forum 1

Hi, I am trying to get to use the grep function in perl, I have been searching web pages but can't get a simple example. I am reading in a .csv file with 7 columns and loads of rows, this is done with: [code] $dat_file = 'sample.csv'; [/code] In the 3rd or 5th column I could find the information I want for example it might have a manufactured such as say nokia. I want to create a new .csv file that just has all rows that contain nokia. I did this very easily in ubuntu with just grep nokia sample.csv …

Member Avatar
Member Avatar
+0 forum 2

Hello, I currently have the following python code: [CODE] #usr/bin/python import os variable=raw_input('Search for this string: ') os.system("grep $variable sample.txt") [/CODE] Basically what I want to do is to grep a string found in the text file "sample.txt" When I run the code, it just hangs. How can I make it so that grep accepts the variable?

Member Avatar
Member Avatar
+0 forum 5

Hello all. I was trying to do some text recovery ([url]http://www.cyberciti.biz/tips/linuxunix-recover-deleted-files.html[/url]) but after running grep -b 'TEXT' /dev/ad0 > good.txt i only see "Binary file /dev/ad0 matches" in the good.txt, whats wrong here ? =) Thanks in advance.

Member Avatar
+0 forum 0

The End.