Help me in awk or sed in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help me in awk or sed in UNIX
# 8  
Old 06-07-2016
Code:
#!/bin/bash

count=1; tarray1=(); tarray2=()

while IFS= read line
do
    if [[ "$count" = "1" ]]; then
     ((count++)); oline1="$line"; tarray1=($oline1)

    elif [[ "$count" = "2" ]]; then
     ((count++)); oline2="$line"; tarray2=($oline2)
     
        if [[ "${tarray2[2]}" =~ "(" ]]; then
         oline1=`echo "$oline1" | sed 's/'${tarray1[4]}'   /'${tarray1[4]}'new/'`
        fi

     printf "%s\n%s\n" "$oline1" "$oline2"

    else
     echo "$line"
     count=1

    fi
done <inputfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX for learning sed/awk/grep..etc..

Greetings all, I am looking for a version of Linux that I can practice my scripting skills on. Currently, I support a massive system running on AIX. I want to do more with awk, sed, grep, and even perl. I am looking for something I can throw on a VM on my personal laptop and mess around with.... (5 Replies)
Discussion started by: jeffs42885
5 Replies

2. How to Post in the The UNIX and Linux Forums

Help me in awk or sed in UNIX

I have a fixed length file that looks like a@ a00 a00000 a00 a000000 a00 a0000 a0000 a00000000 a01 a@ a1 a2 a11 a22 a12 a13 a44 a45 a54 a65 a76 a77 a@ a1 a3 a6 a7 a9 a8 a2 a7 a8 a8 a9 a0 b@ b00 b00000 b00... (1 Reply)
Discussion started by: RJG
1 Replies

3. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

4. Shell Programming and Scripting

Join the line on delimiter using sed/awk in UNIX

I've input as , abcd| ef 123456| 78| 90 Desired output as, abcdef 1234567890 Anyone please give the solution. (5 Replies)
Discussion started by: jinixvimal
5 Replies

5. Shell Programming and Scripting

Awk/sed help

Dear All, The row_eff_tmstp (4th field) and row_expr_tmstp(5th field) in below data represents. If row_expr_tmstp is less than row_eff_tmstp I should replace that as null. First record is header record. I/P ------ DD04 DD040001 DD040001 NO NO NONE ... (1 Reply)
Discussion started by: srikanth38
1 Replies

6. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies

7. UNIX for Dummies Questions & Answers

What should be precedence of using awk, sed, head and tail in UNIX?

Hi All, I am new to unix. In this forum some days back, I have read something like below: 1) Do not use perl if awk can do your work. 2) Do not use awk if sed can do your work. . . . I do not re-collect the whole thing. I think it is good to know the precedence of using these... (2 Replies)
Discussion started by: Prathmesh
2 Replies

8. Shell Programming and Scripting

help with sed or awk

I need to add a field at the beginning of each record in the file. The file is comma seperated. Can somebody throw some light. My record looks something like this I need to add 100 at the beginning of each record. o/p should be (2 Replies)
Discussion started by: dsravan
2 Replies

9. UNIX for Advanced & Expert Users

unix awk/sed program

i need a sample unix awk/sed program to replace param3 in a file. i have sample file a.dat with the following format/length (week 8, sku 20, store 20 and qty 8). all store id's which end with _2 needs to be replaced with div id 2. all store id's which end with _1 needs to be replaced with div id... (4 Replies)
Discussion started by: mnnarendra
4 Replies

10. UNIX for Advanced & Expert Users

sed in awk ? or nested awk ?

Hey all, Can I put sed command inside the awk action ?? If not then can i do grep in the awk action ?? For ex: awk '$1=="174" { ppid=($2) ; sed -n '/$ppid/p' tempfind.txt ; }' tempfind.txt Assume: 174 is string. Assume: tempfind.txt is used for awk and sed both. tempfind.txt... (11 Replies)
Discussion started by: varungupta
11 Replies
Login or Register to Ask a Question
mlib_SignalIIRInit_P4_F32_F32(3MLIB)			    mediaLib Library Functions			      mlib_SignalIIRInit_P4_F32_F32(3MLIB)

NAME
mlib_SignalIIRInit_P4_F32_F32, mlib_SignalIIRInit_P4_F32S_F32S - parallel Infinite Impulse Response (IIR) filtering SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_SignalIIRInit_P4_F32_F32(void **filter, const mlib_f32 flt); mlib_status mlib_SignalIIRInit_P4_F32S_F32S(void **filter, const mlib_f32 flt); DESCRIPTION
Each of these functions allocates memory for the internal filter structure and converts the filter coefficients to an internal representa- tion. PARAMETERS
Each of the functions takes the following arguments: filter Internal filter structure. flt Array of nine filter coefficients: c, a00, a10, b10, b20, a01, a11, b11, and b21. RETURN VALUES
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_SignalIIR_Biquad_S16_S16_Sat(3MLIB), mlib_SignalIIR_P4_S16_S16_Sat(3MLIB), mlib_SignalIIRFree_Biquad_S16_S16(3MLIB), mlib_SignalIIR- Free_P4_S16_S16(3MLIB), mlib_SignalIIRInit_Biquad_S16_S16(3MLIB), attributes(5) SunOS 5.10 9 Nov 2004 mlib_SignalIIRInit_P4_F32_F32(3MLIB)