Sponsored Content
Top Forums Shell Programming and Scripting need a logic for awk programming Post 302160493 by user_prady on Tuesday 22nd of January 2008 02:49:07 AM
Old 01-22-2008
Quote:
Originally Posted by user_prady
Code:
gawk '
 
BEGIN{
}
/\/\/\*Main Start/ {
       while( $0 !~ "\/\/\*Main End"){
       print "Inside Main " $0
       next
       }
  }
/\/\/\*Init Start/ {
       while( $0 ~! "...Init End"){
       print "Inside Init " $0
       next
       }
  }
' myfile

but it shows me error when I use gawk
gawk: cmd. line:10: warning: escape sequence `\/' treated as plain `/'
gawk: cmd. line:10: warning: escape sequence `\*' treated as plain `*'

and in nawk no output..

I want to do something like this
Code:
/\/\/\*Init Start/ {
       print "Inside Init " $0
       while(getline ){
               if ($0 !~ /\/\/\*Init End/){
                       print $0
               }
       }
  }

But not working what exactly I want..
I want to print all those lines Inside Init Start And Init End and nothing else
Yes now I am getting what I want
Code:
/\/\/\*Init Start/ {
       print "Inside Init " $0
               while ($0 !~ /\/\/\*Init End/){
                       getline;
                       print $0
               }
  }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cannot get logic for concatenation awk

Hello friends, I have a problem in printing an array.. Example if my array line contains 4 elements like following line=0002 , line=202200, line=200002, line= 300313 Now one = sprintf line line line line will concatenate my whole array to one. But I am not sure about the... (7 Replies)
Discussion started by: user_prady
7 Replies

2. Shell Programming and Scripting

need a logic to start with awk/ sh

Hi Friends, I got stuck where to start with .. I ve a input file like below. where I want to compare write data with my read data .. The problem is that the read data should be compared with the lastest write data on that address. Note- Both write data & read data are in the same... (8 Replies)
Discussion started by: user_prady
8 Replies

3. Shell Programming and Scripting

Help with awk logic

I want to print lines that have "IND" or "ind" or nothing in field 2 or 3 file: output needed: Code i wrote: nawk -F"," '{if(tolower($2||$3) ~"ind"||"")print}' file Help is appreciated (3 Replies)
Discussion started by: pinnacle
3 Replies

4. Shell Programming and Scripting

need an awk script/logic

In one data file i have values like this a b c 1 2 e f g 2 3 i j k 3 5 I need to sum up the last 2 columns and make a data file...How i can do that. a b c 1 2 e f g 2 3 i j k 3 5... (8 Replies)
Discussion started by: bobprabhu
8 Replies

5. UNIX for Dummies Questions & Answers

Need help in logic using awk command

I have task to find out the min,max, average value of each service for example i searched for " StatementService " $awk '/VST.*StatementService:/{print $3,$4,$19,$22,$25}' performance.log > smp.log $cat smp.log amexgtv VST: : StatementService:1860 StatementService:getCardReference:0... (3 Replies)
Discussion started by: senthil.ak
3 Replies

6. UNIX for Dummies Questions & Answers

awk logic and math help

Hi, My file has 2 fields and millions of lines. variableStep chrom=Uextra span=25 201 0.5952 226 0.330693 251 0.121004 276 0.0736858 301 0.0646982 326 0.0736858 401 0.2952 426 0.230693 451 0.221004 476 0.2736858 Each field either has a... (6 Replies)
Discussion started by: wyarosh
6 Replies

7. Shell Programming and Scripting

How to use this logic with awk?

Hi friends, I am having 2 files, I just want to compare 2 files each containing 2 columns 1st column is lat, and 2nd column is long, if anyone can understand below logic please help me in writing script with awk.. here each field of file2 needs to be compared with std_file main counter=0... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

8. Shell Programming and Scripting

Programming logic help

Hi, I was having a problem regarding this thread: https://www.unix.com/shell-programming-scripting/225221-setting-variable-using-variables-loop.html I have not been able to solve that issue. So i was thinking maybe my logic to solve the overall problem is wrong, so i am looking for a bit of... (2 Replies)
Discussion started by: brunlea
2 Replies

9. Shell Programming and Scripting

awk logic

I am trying to check my logic on a long awk i'm using. I have about 30 checks that I built into an awk and I "believe" I did this right, but I could be wrong. awk -F\| ' $9 !~ /\/*{1,}*/ $9 ~ /\(-{4}, {2,3}/ $9 ~ /\({6}, {2,3}\)/ $9 ~ /\(\+{5}, {2,3}\)/ $9 ~ /\(\+\+{4}, {2,3}\)/ $9 ~... (8 Replies)
Discussion started by: dagamier
8 Replies

10. Shell Programming and Scripting

More a logic than a programming question

hello, I'm a littlebit lost... i have a table of single names and combination of two names and i want a table of ALL single names with ALL combinations (also the indirect ones). - - - in reality the names are longer, not only a,b,.. and the table is tab-delimited, and the result table... (6 Replies)
Discussion started by: dietmar13
6 Replies
PHYSFS_Allocator(3)						      physfs						       PHYSFS_Allocator(3)

NAME
PHYSFS_Allocator - PhysicsFS allocation function pointers. SYNOPSIS
#include <physfs.h> Data Fields int(* Init )(void) void(* Deinit )(void) void *(* Malloc )(PHYSFS_uint64) void *(* Realloc )(void *, PHYSFS_uint64) void(* Free )(void *) Detailed Description PhysicsFS allocation function pointers. (This is for limited, hardcore use. If you don't immediately see a need for it, you can probably ignore this forever.) You create one of these structures for use with PHYSFS_setAllocator. Allocators are assumed to be reentrant by the caller; please mutex accordingly. Allocations are always discussed in 64-bits, for future expansion...we're on the cusp of a 64-bit transition, and we'll probably be allocating 6 gigabytes like it's nothing sooner or later, and I don't want to change this again at that point. If you're on a 32-bit platform and have to downcast, it's okay to return NULL if the allocation is greater than 4 gigabytes, since you'd have to do so anyhow. See also: PHYSFS_setAllocator Field Documentation void(* PHYSFS_Allocator::Deinit)(void) Deinitialize your allocator. Can be NULL. void(* PHYSFS_Allocator::Free)(void *) Free memory from Malloc or Realloc. int(* PHYSFS_Allocator::Init)(void) Initialize. Can be NULL. Zero on failure. void*(* PHYSFS_Allocator::Malloc)(PHYSFS_uint64) Allocate like malloc(). void*(* PHYSFS_Allocator::Realloc)(void *, PHYSFS_uint64) Reallocate like realloc(). Author Generated automatically by Doxygen for physfs from the source code. Version 2.0.2 Fri Feb 24 2012 PHYSFS_Allocator(3)
All times are GMT -4. The time now is 04:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy