As you know we can capture paragraph information using -ip command with grep option in AIX and other OS. Is there anything similar to this command in linux to capture paragraph infroamtion?
coammnd:
Thanks
---------- Post updated at 07:38 PM ---------- Previous update was at 01:45 PM ----------
Hi,
Any clue on this please? Appreciate your quick response on this.
Thanks
Jayaprakash.
Last edited by zaxxon; 03-16-2011 at 09:47 AM..
Reason: code tags
Don't bump posts to get a faster response. You agreed not to do that when you registered, and we even have an "emergency" forum for things that need a quick response.
GNU grep definitely does not have "-p". It has "-P" which is not the same thing.
What exactly does this "-p" option do in AIX? What do you mean by paragraph information? Islands of text surrounded by blank lines? you could use awk's record separator feature to read text in that kind of blocks. awk will read entire blocks of text separated by newlines when RS="", which you can match and print. GNU awk should be able to handle blocks of substantial size.
From "AIX Version 4.3 Commands Reference, Volume 2" (http://www.ualberta.ca/dept/chemeng/...ds2/grep.htm):
-p[Separator] Displays the entire paragraph containing matched lines. Paragraphs are delimited by paragraph separators, as specified by the Separator parameter, which are patterns in the same form as the search pattern. Lines containing the paragraph separators are used only as separators; they are never included in the output. The default paragraph separator is a blank line.
Also, as a note:
Paragraphs (under the -p flag) are currently limited to a length of 5000 characters.
Ergo, no. Linux grep has nothing like this AFAIK.
I have a file xyz with the following content
PPPL 0123
PPPL 0006
POFT 0923
POFT 1111
WENT 2323
SEND 2345
I also have another file named MasterFile where it contains the above mentioned data million times with different digits at the end for example some times it contains SEND 9999 or WENT... (4 Replies)
Hello,
I am on a Mac and trying to clean up some monthly files with a very simple SED:
sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt
(from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file)
then output to output.txt
Even when I try... (2 Replies)
Hello,
I am running below command as root user
#nodetool cfstats tests | grep "Memtable switch count"
Memtable switch count: 12
Where as when I try to run same command as another user it gives different result.
#su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Hi All
I have a file containing following records:
$HEW_TGT_DB2_USER=hbme_bi2
$prmAttunityUser=ais
$DS_USER=hbme_bi2
$prmStgUser=hbme_bi2
$prmuser=hbme_bi2
$prmStgPass=hbme_bi2
$prmpwd=hbme_bi2
$prmAttunityUser=ais
Say suppose the name of the file is test4.txt
When i fire this... (5 Replies)
Hi All
I am trying to run a script in linux wherein i have a command like this
grep ^prmAttunityUser= djpHewr2XFMAttunitySetup_ae1_tmp
djpHewr2XFMAttunitySetup_ae1_tmp is a temporary file in which the user value is stored but this command in the script returns me balnk value whereas it has a... (4 Replies)
i want to search in the current directory all the files that contain one word for example "hello"
i want to achieve it with the grep command but not with the grep * (2 Replies)
I am doing "ps -f" to see my process.
but I get lines that one of it represents the ps command itself.
I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself :
I would like to exclude
# ps -f
UID PID PPID C STIME TTY TIME CMD... (2 Replies)