Sponsored Content
Top Forums Shell Programming and Scripting awk to combine lines from line with pattern match to a line that ends in a pattern Post 302967259 by RudiC on Monday 22nd of February 2016 02:51:13 AM
Old 02-22-2016
Would this help?
Code:
awk '
tolower(T = $0) ~ "^libname [^ ]+ db2 datasrc" \
        {while (! /;$/) {getline X
                         sub (/^ +/, " ", X)
                         $0 = $0 X
                        }
        }
1
' file
libname &wrk_schema DB2 database = %sysget( DB2DBDFT ) schema = &wrk_schema read_isolation_level = ur ;
libname schema db2 datasrc=%sysfunc(sysget(DB2DBDFT)) schema=&qmt_schema read_isolation_level=ur;
libname db2lib db2 datasrc=crd_prod ;
libname server db2 datasrc=%sysfunc(sysget(DB2DBDFT)) ril=ur;
libname server db2 datasrc=%sysfunc(sysget(DB2DBDFT));
libname server db2 datasrc=%sysfunc(sysget(DB2DBDFT)) schema = &build_schema access = readonly connection = globalread read_isolation_level=ur;
libname server2 db2 datasrc=%sysfunc(sysget(DB2DBDFT)) schema = &build_schema2 access = readonly connection = globalread read_isolation_level=ur;

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenating multiple lines to one line if match pattern

Hi all, I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file: Severity............: MAJORWARNING Summary: System temperature is out of normal range. Severity............: MAJORWARNING... (13 Replies)
Discussion started by: phixsius
13 Replies

2. Shell Programming and Scripting

How to insert line with between two consecutive lines that match special pattern?

I have following pattern in a file: 00:01:38 UTC abcd 00:01:48 UTC 00:01:58 UTC efgh 00:02:08 UTC 00:02:18 UTC and I need to change something like the following 00:01:38 UTC abcd 00:01:48 UTC XXXX 00:01:58 UTC efgh 00:02:08 UTC XXXX (6 Replies)
Discussion started by: jjnight
6 Replies

3. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

4. Shell Programming and Scripting

Awk-sed help : to remove first and last line with pattern match:

awk , sed Experts, I want to remove first and last line after pattern match "vg" : I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data. - So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Discussion started by: rveri
5 Replies

5. Shell Programming and Scripting

awk print pattern match line and following lines

Data: Pattern Data Data Data Data Data Data Data Data Data ... With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Discussion started by: dmesserly
9 Replies

6. Shell Programming and Scripting

Rearrange or replace only the second line after pattern match or pattern match

Im using the command below , but thats not the output that i want. it only prints the odd and even numbers. awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}' Im hoping for something like this file1: Text hi this is just a test text1 text2 text3 text4 text5 text6 Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies

7. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

8. UNIX for Beginners Questions & Answers

awk script for pattern match and line break

Hi, I have input which reads like 9089.00 ----- kl jkjjljk lkkk; (909099) 9097.00 ----- HGJJHHJ jcxkjlkjvhvlk jhdkjksdfkhfskd 898.00 ----- HHHH I am trying to do something like this - As soon as I found pattern match "XYZ.00-----" it will insert a line break to the input and will go to... (3 Replies)
Discussion started by: Indra2011
3 Replies

9. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
FIPSCHECK(3)							     fipscheck							      FIPSCHECK(3)

NAME
FIPSCHECK_verify, FIPSCHECK_verify_ex, FIPSCHECK_verify_files, FIPSCHECK_verify_files_ex, FIPSCHECK_fips_module_installed, FIPSCHECK_get_binary_path, FIPSCHECK_get_library_path, FIPSCHECK_kernel_fips_mode, fipscheck.h - Various functions relating to running in FIPS mode SYNOPSIS
#include <fipscheck.h> int FIPSCHECK_verify(const char *libname, const char *symbolname); int FIPSCHECK_verify_ex(const char *libname, const char *symbolname, const char *hmac_suffix, int fail_if_missing); int FIPSCHECK_verify_files(const char *files[]); int FIPSCHECK_verify_files_ex(const char *hmac_suffix, int fail_if_missing, const char *files[]); int FIPSCHECK_fips_module_installed(const char *libname, const char *symbolname, const char *hmac_suffix); int FIPSCHECK_get_binary_path(char *path, size_t pathlen); int FIPSCHECK_get_library_path(const char *libname, const char *symbolname, char *path, size_t pathlen); int FIPSCHECK_kernel_fips_mode(void); DESCRIPTION
The function FIPSCHECK_kernel_fips_mode() tests for the FIPS-140-2 mode in kernel. The function FIPSCHECK_verify() computes and compares HMAC-SHA256 checksum by spawning the fipscheck command. The parameters libname and symbolname determine which shared library file loaded into the process space will be checksummed. If these parameters are set to NULL, the executable of the calling process is checksummed. The function FIPSCHECK_verify_ex() in addition to the functionality above also allows to specify the full hmac_suffix with the default value of .hmac. And will return success if the hmac file is missing and the fail_if_missing parameter is set to 0. The function FIPSCHECK_verify_files() can be used to explicitly specify NULL terminated array of file names in the parameter files to check. Similarly the function FIPSCHECK_verify_files_ex() in addition to the functionality above also allows to specify the full hmac_suffix with the default value of .hmac. And will return success if the first hmac file is missing and the fail_if_missing parameter is set to 0. The checksum file contains the HMAC-SHA256 encoded in hexadecimal notation using lowercase letters with one EOL character appended at the end. The function FIPSCHECK_fips_module_installed() returns 1 if the hmac checksum file is found and 0 otherwise. The functions FIPSCHECK_get_library_path() and FIPSCHECK_get_binary_path() return the shared library and executable paths in the path. The buffer pointed to by the parameter must be large enough to hold the path otherwise the path is truncated. The size of the buffer is specified by the pathlen. RETURN VALUE
The main functions FIPSCHECK_verify() and FIPSCHECK_verify_files() return 1 when the verification of the binaries succeeds and 0 otherwise. The function FIPSCHECK_kernel_fips_mode() returns 1 when the kernel is in fips mode and 0 otherwise. The auxiliary functions FIPSCHECK_get_binary_path() and FIPSCHECK_get_library_path() return 0 on success and -1 if the path cannot be determined. FIPS MODE
A kernel compiled with CONFIG_CRYPTO_FIPS=y can be booted in fips mode by specifying fips=1 as kernel parameter. Please refer to the security policy of the Kernel FIPS module for further details. SEE ALSO
fipscheck(8), fipshmac(8), https://fedorahosted.org/fipscheck/ AUTHOR
Tomas Mraz <tmraz@redhat.com>. Man page authors Paul Wouters <pwouters@redhat.com> and Tomas Mraz <tmraz@redhat.com>. COPYRIGHT
Copyright 2008, 2012 Red Hat, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. fipscheck 16 April 2012 FIPSCHECK(3)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy