Sponsored Content
Top Forums Shell Programming and Scripting AWK script problem insertion of code Post 302503706 by jaita on Friday 11th of March 2011 11:14:17 AM
Old 03-11-2011
Network AWK SCRIPT PROBLEM

I tried the below Flow

I did some vi editing work to create the File as shown below

Code:
 
FILE1 
###########################
 
input SI_TESTONLY_R_00;
input CE0_SE_INPUT_TESTONLY;
input CE0_TCLK_TESTONLY;
output SO_TESTONLY_R_00;

input SI_JTGCLOCKDR_JTAG_R_00;
input CE0_TCLK_JTGCLOCKDR_JTAG;
input CE0_SE_INPUT_JTGCLOCKDR_JTAG;
output SO_JTGCLOCKDR_JTAG_R_00;

but these pins are in different order

Appended the FIle like this

Code:
 
cat FILE2 >> FILE1

Code:
 
awk '{a[FNR]=$2 } END { gsub(P1,a[0]), gsub(P2,a[1], gsub(P3,a[2]) ,gsub(P5,a[3}1' FILE1

Code:
 
cat FILE2 >> FILE1

Code:
 
awk '{a[FNR]=$2 } END { gsub(P1,a[0]), gsub(P2,a[1], gsub(P3,a[2]) ,gsub(P5,a[3}1' FILE1


In this way I am trying to get the output

But it is very messy

Can you help me to make this code more versatile

Issues

a)Sorting of the Pins according to the Pattern match

b) Looping the stuff to insert the Code like the Output File

I did the Initial work before writing the mail and thats why I asked for help , If you think you can help me out I am indebted to you

Thanks
Jaita
 

10 More Discussions You Might Find Interesting

1. AIX

problem with Unicode characters insertion

hi, I have a problem with unicode chars ( chinese, japanese etc ) insertion using sqlplus prompt. When i wrote a proc program for it i am able to create records. But when i fore the same query on sql prompt it stores reverse ????? ..some junk. widechar columns are mapped with NVARCHAR datatype.... (0 Replies)
Discussion started by: suman_jakkula
0 Replies

2. Shell Programming and Scripting

Problem with awk script

Hi Can anyone help me in this Problem File1 ######################### HOLI 123 AND ONE TWO THREE AMITABH SAMSUNG POLI AND TWO SENSE CRYING WING PPIN TBFLAG I B AND OROLE TB_HOT=" DCT" TB_CAT=" CAT" TC_NOT=" AND" +PIN TB=" HOT" TB_GATE=" KOT" TB_LATE=" MAT" TC=LOT MAT DAT SAT... (5 Replies)
Discussion started by: kshitij
5 Replies

3. Shell Programming and Scripting

Problem with a AWK Script

Hi I am having some contents in my file like this file1 ########################## pin (PIN1) { direction : input ; capacitance : 121 ; max_transition : 231 ; } pin (PIN2) { direction : input ; capacitance : 124 ; max_transition : 421 ;... (8 Replies)
Discussion started by: kshitij
8 Replies

4. Shell Programming and Scripting

insertion of text from sed script

Hi , This is my first thread ; facing some issues withmy sed script I need to insert the code from my log file which is between two keywords. content is like this ........ log ############################ log1 log2 231 "Ban" "tom" and the line one of the cross line friend... (2 Replies)
Discussion started by: shalini_008
2 Replies

5. Shell Programming and Scripting

zip code filter problem using AWK need help

Hello all; I have a large file (csv file) with addresses. I am trying to filter out specific entries based on zip code from a particular column of data. However my awk statement can not account for zipcode that begins with a certain pattern. It finds the pattern anywhere within the zipcode. ... (3 Replies)
Discussion started by: nelsonsierra
3 Replies

6. Shell Programming and Scripting

awk script problem

Hi, How to check status of the files in the awk script i am having two awk script in one bash script.Like -BELOW is the exact structure of the script script name: new.sh { awk -v v1=`.....` { if (){ exit -1; } } } }'$file name1 { awk -v v2=`.....` { if (){ ... (5 Replies)
Discussion started by: Ganesh Khandare
5 Replies

7. Shell Programming and Scripting

awk script problem

Hi I am having a big file where the interested section is shown below I need to write one awk script to search for the _N thing and delete it till the blank space means _N1 or _N4 everything needs to be deleted Removing the links like _N402 and like that ... (5 Replies)
Discussion started by: jaita
5 Replies

8. Shell Programming and Scripting

Need help in using sed/awk for line insertion in xml

Hello, I have two text files (txt1 and txt2). txt1 contains many lines with a single number in each line. txt2 (xml format) contains information about the numbers given in txt1. I need to insert one line in txt2 within the scope of each number taken from txt1. Sample problem: txt1: 12 23... (1 Reply)
Discussion started by: shekhar2010us
1 Replies

9. Shell Programming and Scripting

Awk/sed problem to write Db insertion statement

Hi There, I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB My exiting csv record... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

10. UNIX for Beginners Questions & Answers

UNIX shell script for matrix insertion into a file

I have a script which is extracting data from a database in an excel file in below given format, date_time calling_app1 count of requests date calling_app x 34 date calling_app y 1034 I want to write a script which will write data into a file like this ... (3 Replies)
Discussion started by: TNT47
3 Replies
JOIN(1) 							   User Commands							   JOIN(1)

NAME
join - join lines of two files on a common field SYNOPSIS
join [OPTION]... FILE1 FILE2 DESCRIPTION
For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by whitespace. When FILE1 or FILE2 (not both) is -, read standard input. -a FILENUM print unpairable lines coming from file FILENUM, where FILENUM is 1 or 2, corresponding to FILE1 or FILE2 -e EMPTY replace missing input fields with EMPTY -i, --ignore-case ignore differences in case when comparing fields -j FIELD equivalent to `-1 FIELD -2 FIELD' -o FORMAT obey FORMAT while constructing output line -t CHAR use CHAR as input and output field separator -v FILENUM like -a FILENUM, but suppress joined output lines -1 FIELD join on this FIELD of file 1 -2 FIELD join on this FIELD of file 2 --check-order check that the input is correctly sorted, even if all input lines are pairable --nocheck-order do not check that the input is correctly sorted --help display this help and exit --version output version information and exit Unless -t CHAR is given, leading blanks separate fields and are ignored, else fields are separated by CHAR. Any FIELD is a field number counted from 1. FORMAT is one or more comma or blank separated specifications, each being `FILENUM.FIELD' or `0'. Default FORMAT outputs the join field, the remaining fields from FILE1, the remaining fields from FILE2, all separated by CHAR. Important: FILE1 and FILE2 must be sorted on the join fields. E.g., use `sort -k 1b,1' if `join' has no options. If the input is not sorted and some lines cannot be joined, a warning message will be given. AUTHOR
Written by Mike Haertel. REPORTING BUGS
Report join bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> COPYRIGHT
Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for join is maintained as a Texinfo manual. If the info and join programs are properly installed at your site, the command info coreutils 'join invocation' should give you access to the complete manual. GNU coreutils 7.1 July 2010 JOIN(1)
All times are GMT -4. The time now is 03:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy