Sponsored Content
Top Forums Shell Programming and Scripting awk - Skip x Number of Lines in Counter Post 302956653 by RudiC on Thursday 1st of October 2015 04:15:17 PM
Old 10-01-2015
Try
Code:
awk '
BEGIN   {n=split ("Location,Status,Service Type,Service Provider,ID", HD, ",")
         n=split ("1 6 7 8 9", FIELD)
        }
        {for (i=1; i<=n; i++) print HD[i] ":"  $FIELD[i]
         print ""
        }
' RS="" FS="\n" file
Location:WORD1
Status:Active
Service Type:ISP1
Service Provider:ISP NAME1
ID:XX-XXXXXX1

Location:WORD1
Status:Active
Service Type:ISP2
Service Provider:ISP NAME2
ID:XX-XXXXX2

Location:WORD2
Status:Active
Service Type:ISP1
Service Provider:ISP NAME1
ID:XX-XXXXX1

Location:WORD2
Status:Active
Service Type:ISP2
Service Provider:ISP NAME2
ID:XX-XXXXX2

These 2 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print number of lines with awk ?

Can some body tell me how to print number of line from a particular file, with sed. ? Input file format AAAA BBBB CCCC SDFFF DDDD DDDD Command to print line 2 and 3 ? BBBB CCCC And also please tell me how to assign column sum to variable. I user the following command it... (1 Reply)
Discussion started by: maheshsri
1 Replies

2. Shell Programming and Scripting

awk, ignore first x number of lines.

Is there a way to tell awk to ignore the first 11 lines of a file?? example, I have a csv file with all the heading information in the first lines. I want to split the file into 5-6 different files but I want to retain the the first 11 lines of the file. As it is now I run this command: ... (8 Replies)
Discussion started by: trey85stang
8 Replies

3. Shell Programming and Scripting

How to skip lines in a KSH?

hi, I have a shell script that searches for a particular pattern in all the files inside a directory, and gives the count of that pattern occurences in a file. Now i should not count the pattern if it exists in side a { .... }, as shown below. { ...... ..... .... PATTERN1.......... (1 Reply)
Discussion started by: divak
1 Replies

4. Shell Programming and Scripting

How to skip lines which don't begin with a number

Hi, I have a file: file.txt 1 word 2 word word word 3 word 4 word and I would like to create a set: set number = `cut -d" " -f1 ${1}` #${1} is the text file but it should only contain the lines which begin with numbers, and another set which contains the lines which begin with... (10 Replies)
Discussion started by: shira
10 Replies

5. Shell Programming and Scripting

awk - skip x lines and ssh

Im trying to ssh to a remote machine to grep 'x info' *.log and Im able to get the grep output as expected but "after" the policies (1st 14 lines) - I need to skip the first 14 lines. Its SunOS. Plz help??? (1 Reply)
Discussion started by: anthonyraj75
1 Replies

6. Shell Programming and Scripting

awk: skip x lines and ssh

Im trying to ssh to a remote machine to grep 'x info' *.log and Im able to get the grep output as expected but "after" the policies (1st 14 lines) - I need to skip the first 14 lines. Its SunOS. Plz help??? (7 Replies)
Discussion started by: anthonyraj75
7 Replies

7. Shell Programming and Scripting

Awk number of lines

How do I get the last NR of a csv file? If I use the line awk -F, '{print NR}' csvfile.csv and there are 42 lines, I get: ... 39 40 41 42 How do I extract the last number, which in this case is 42? ---------- Post updated at 11:05 AM ---------- Previous update was at 10:57 AM... (1 Reply)
Discussion started by: locoroco
1 Replies

8. Shell Programming and Scripting

How to use counter to run the script to limit number?

I want to run my shell script to the limit number.Suppose I know in advance that MAX=5 then I want that my script run 5 times only.Something like below$ vi testingMAX=5COMMAND=&quot;ssh -l stpuser VHLDVWSAD001 /projects/st/utils/deploy/deployall.sh >/dev/null 2>&1 &&quot; ; sleep 20;count=0while... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

9. Shell Programming and Scripting

awk to output lines less than number

I am trying to output all lines in a file where $7 is less than 30. The below code does create a result file, but with all lines in the original file. The original file is tab deliminated is that the problem? Thank you :). awk 'BEGIN{FS=OFS=","} $7 < 30 {print}' file.txt > result.txt... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. Shell Programming and Scripting

awk to skip lines find text and add text based on number

I am trying to use awk skip each line with a ## or # and check each line after for STB= and if that value in greater than or = to 0.8, then at the end of line the text "STRAND BIAS" is written in else "GOOD". So in the file of 4 entries attached. awk tried: awk NR > "##"' "#" -F"STB="... (6 Replies)
Discussion started by: cmccabe
6 Replies
dat_psp_create_any(3DAT)			     Direct Access Transport Library Functions				  dat_psp_create_any(3DAT)

NAME
dat_psp_create_any - create a persistent Public Service Point SYNOPSIS
cc [ flag... ] file... -ldat [ library... ] #include <dat/udat.h> DAT_RETURN dat_psp_create_any( IN DAT_IA_HANDLE ia_handle, IN DAT_CONN_QUAL conn_qual, IN DAT_EVD_HANDLE evd_handle, IN DAT_PSP_FLAGS psp_flags, OUT DAT_PSP_HANDLE *psp_handle ) PARAMETERS
ia_handle Handle for an instance of DAT IA. conn_qual Connection Qualifier of the IA on which the Public Service Point is listening. evd_handle Event Dispatcher that provides the Connection Requested Events to the Consumer. The size of the event queue for the Event Dispatcher controls the size of the backlog for the created Public Service Point. psp_flags Flag that indicates whether the Provider or Consumer creates an Endpoint per arrived Connection Request. The value of DAT_PSP_PROVIDER indicates that the Consumer wants to get an Endpoint from the Provider; a value of DAT_PSP_CONSUMER means the Consumer does not want the Provider to provide an Endpoint for each arrived Connection Request. psp_handle Handle to an opaque Public Service Point. DESCRIPTION
The dat_psp_create_any() function creates a persistent Public Service Point that can receive multiple requests for connection and generate multiple Connection Request instances that are delivered through the specified Event Dispatcher in Notification events. The dat_psp_create_any() function allocates an unused Connection Qualifier, creates a Public Service point for it, and returns both the allocated Connection Qualifier and the created Public Service Point to the Consumer. The allocated Connection Qualifier should be chosen from "nonprivileged" ports that are not currently used or reserved by any user or ker- nel Consumer or host ULP of the IA. The format of allocated Connection Qualifier returned is specific to IA transport type. The dat_psp_create_any() function is blocking. When the Public Service Point is created, DAT_SUCCESS is returned, psp_handle contains a handle to an opaque Public Service Point Object, and conn_qual contains the allocated Connection Qualifier. When return is not DAT_SUCCESS, psp_handle and conn_qual return values are undefined. There is no explicit backlog for a Public Service Point. Instead, Consumers can control the size of backlog through the queue size of the associated Event Dispatcher. The psp_flags parameter allows Consumers to request that the Provider create an implicit Endpoint for each incoming Connection Request, or request that the Provider should not create one per Connection Request. If the Provider cannot satisfy the request, the operation shall fail and DAT_MODEL_NOT_SUPPORTED is returned. All Endpoints created by the Provider have DAT_HANDLE_NULL for the Protection Zone and all Event Dispatchers. The Provider sets up End- point attributes to match the Active side connection request. The Consumer can change Endpoint parameters. Consumers should change Endpoint parameters, especially PZ and EVD, and are advised to change parameters for local accesses prior to the connection request acceptance with the Endpoint. RETURN VALUES
DAT_SUCCESS The operation was successful. DAT_INSUFFICIENT_RESOURCES The operation failed due to resource limitations. DAT_INVALID_HANDLE The ia_handle or evd_handle parameter is invalid. DAT_INVALID_PARAMETER The conn_qual or psp_flags parameter is invalid. DAT_CONN_QUAL_UNAVAILABLE No Connection Qualifiers available. DAT_MODEL_NOT_SUPPORTED The requested Model was not supported by the Provider. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard: uDAPL, 1.1, 1.2 | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
libdat(3LIB), attributes(5) SunOS 5.11 16 Jul 2004 dat_psp_create_any(3DAT)
All times are GMT -4. The time now is 11:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy