Ok, I have some experience with awk, but I haven't touched it for years ... back again and I have one problem.
I have large char file, it has hundreds of major text blocks. First, I need to grab and process those, and ignore everything else. That bit is simple.
Within those major text blocks, there are 3 to 32 minor text blocks. Second, I need to process those. Here's what the data looks like this:
This is what I would like to code (of course it doesn't work). Note, I need bits from the major_block while processing the minor_block, such as var1:
I was certain I have done this before (without leaving awk), but I cannot find evidence of that. I looked at my old awk scripts, they seem to process the major_block; then use if-then-else. But the need was not quite the same.
I searched this forum, and the closest question is "parsing-file-extracting-useful-data-block". (close but not quite, because that particular bit did not get answered). I an seeking the following:
1. Instructions to get awk to do what I want.
2. Alternately, can I capture everything in major_block and write that to a file_B; then process it with "system(awk ... file_B)"
3. Alternately, can someone who is an awk geek confirm to me that awk is a single-pass design, with no iteration.
TIA
Last edited by DerekAsirvadem; 12-28-2010 at 02:26 AM..
Hi, how would we replace a few patterns on the same line with a change of it's own..using visual block on vim editor.
ie a file contains lines such as the following:
abccss (dfrss)) emailkk
abdcss (dfrss)) dmailkk
Using visual block once, replacement is indeed to get the following output:... (0 Replies)
Hi friends,
I have written script that will search & display the block of sql statement. Since there are many blocks of sql statement i am finding it difficult to distinguish between them. The below is the sed command & its result
exec sql
abc
abc
abc... (2 Replies)
Hello,
I've been racking my brain trying to find a good way to accomplish a task. I need to insert a block of text into a file in the format of
FirewallRuleSet proxy-users {
FirewallRule allow to 0.0.0.0/0
}
I need to insert this block of text (which could have sed special... (2 Replies)
I was reading a book on UNIX internals "The design of the UNIX Operating system." There are two memory structures that are confusing me:
1) Buffer cache
2) Inode cache
My questions are
1) Does a process get both buffer cache and Indoe cache allocated when it opens/creates a file?
2) if no,... (1 Reply)
I have a "main" file which has blocks of data for each user defined by tags BEGIN and END.
BEGIN
ID_NUM:24879
USER:abc123
HOW:47M
CMD1:xyz1
CMD2:arp2
STATE:active
PROCESS:id60
END
BEGIN
ID_NUM:24880
USER:def123
HOW:4M
CMD1:xyz1
CMD2:xyz2
STATE:running
PROCESS:id64
END (7 Replies)
I want to process a file block by block using sed, and if that block does not contain two patterns, then that complete block has to be printed.
See below for the example data.
................................server 1...............................
running process 1
running... (8 Replies)
I want to search for a block of text in httpd.conf that between two strings and comment it. There are multiple blocks with "<Directory.. and </Directory>"
<Directory "${ORACLE_INSTANCE}/config/${COMPONENT_TYPE}/${COMPONENT_NAME}/htdocs">
#
# Possible values for the Options directive are... (3 Replies)
Hi,
I have a scenario where I want to display the output based on the pattern search between the start and end of a block in a file, we can have multiple start and end blocks in a file.
Example give below, we need to search between the start block abc and end block def in a file, after that... (5 Replies)