Sponsored Content
Top Forums UNIX for Beginners Questions & Answers TCL script to insert some text on a file Post 303040433 by kshitij on Tuesday 29th of October 2019 06:38:51 AM
Old 10-29-2019
TCL script to insert some text on a file

Hi All ,

I am looking to create one TCL script to insert one text based on some regular expression match on one file as stated below

Input File
Code:
module (mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2 , 
ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2 );

output ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2;
input mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;
wire mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;

endmodule

I have to insert below stated text to the above input file
bist_m_p::mst_in_m_ram_t bist_in
bist_sm_p::bist_out_m_sram_t bist_out

The output file should look like this

Output file

Code:
module (mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2 , 
ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2,bist_m_p::mst_in_m_ram_t  bist_in ,bist_sm_p::bist_out_m_sram_t bist_out );

output ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2;bist_m_p::mst_in_m_ram_t  bist_in;
input mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;bist_sm_p::bist_out_m_sram_t bist_out;
wire mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2;



endmodule

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

2. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

3. Shell Programming and Scripting

awk script to insert text in file

I'm in a time crunch here and I don't know how to write scripts. I have a file of data that looks like the following: 1 7.652073E+00 0.000000E+00 7.146691E+02 1.704154E+01 2 7.652068E+00 6.031387E+00 7.146636E+02 2.499305E+01 3 7.645906E+00 1.509455E+01 7.144158E+02 1.822061E+02 4... (7 Replies)
Discussion started by: pk218703
7 Replies

4. Shell Programming and Scripting

Insert Text On file

Hi All, Can someone pls help me to insert some text on a file. my file contains something like below.. AKBULBU, BALUMIL, BATCH,BATCH BOARROB, BOTAKAT, C57896, CAKIOZE, CHECMER, CICOFRA, CISZPAW,2194485 I want output as USER_ID, LOGIN_ID (6 Replies)
Discussion started by: harshakusam
6 Replies

5. Shell Programming and Scripting

Script to insert text from one file to other file

Hello Team, I need help in preparing script which will insert text from one file to other file. I have requirement to prepare script which will insert data from one file to another file. I have tried using sed and awk command but it is not useful to me as it does not append data in the... (12 Replies)
Discussion started by: coolguyamy
12 Replies

6. Programming

Parsing a text file in Tcl

Hi all, I need to parse through a text file searching for a specific string, then after I find this string read in remaining data off the line to a variable. I've tried various things and can't seem to get any to work. Any help would be much appreciated. (2 Replies)
Discussion started by: caboose57
2 Replies

7. Shell Programming and Scripting

Shell Script to insert text after Tag

Hello, I'm doing an Shell Script to insert a text on XML file, i tried sed, awk, perl... i'm doing something wrong, please help me :) well, the script is a bit large, i get some infos on script before 'run' this part to insert the text on XML... domobile() { let i++ echo ... (1 Reply)
Discussion started by: tassomanoel
1 Replies

8. UNIX for Dummies Questions & Answers

Insert text into a file using shell script

Hi, I need to insert "Hello World" text into a file called hai.txt using shell scripting. Kindly help me. For eg: If I open the file hai.txt by giving linux command cat hai.txt, the content of the file should have the text Hello World in it. Thanks (5 Replies)
Discussion started by: karthick nath
5 Replies

9. Shell Programming and Scripting

How to insert text within a file?

Hi, I am trying to check for missing dates in a file and would want to insert the missing date into the file. Currently the script is as below #!/bin/ksh dates="dates" cat ${dates} | grep -v "^#" curr_month=`date '+%m` curr_day=`date '+%d` curr_year=`date '+%Y` #curr_month=02... (7 Replies)
Discussion started by: newbie_01
7 Replies
nisldapmaptest(1M)					  System Administration Commands					nisldapmaptest(1M)

NAME
nisldapmaptest - test NIS+ and LDAP mapping configuration files SYNOPSIS
nisldapmaptest [-s | -r | -d] [-l | -t object] [-v] [-i] [-o] [-m conffile] [ -x attr=val...] [ col=val...] DESCRIPTION
Use the nisldapmaptest utility to test NIS+ to LDAP mapping configuration files. See NIS+LDAPmapping(4). The nisldapmaptest utility uses much of the same internal interface as the rpc.nisd(1M) does to read, add, modify, or delete LDAP data, as specified by the column name and value operand pairs. nisldapmaptest does not read or modify any of the rpc.nisd(1M) database files. See NOTES for details on important differences between the ways that nisldapmaptest and rpc.nisd(1M) operate on LDAP data. OPTIONS
The nisldapmaptest utility supports the following options: -d Delete data in LDAP. -i Ignore failures when obtaining information from the NIS+ server. This enables nisldapmaptest to work to some extent, even if the NIS+ server is unreachable, or if the system is not a NIS+ client. However, NIS+ lookups are still attempted, so there may be NIS+ error messages. In this mode, nisldapmaptest also tries to guess things such as NIS+ object types and derives table column information from the mapping rules in the configuration files. Avoid using the -i option to add, modify, or delete, until you have determined that the nisldapmaptest's guesses are adequate for your needs. -l Parse the configuration file into internal data structures, and then print out the configuration per those structures. Note that the printed data is not in configuration file format. Either -l or -t must be specified. If both are present, -l is ignored. -m conffile Specify the name of the NIS+LDAPmapping(4) configuration file. The default directory is /var/nis , and the default mapping file is NIS+LDAPmapping. -o For NIS+ tables, work on the NIS+ object itself, specified by means of the -t option, not on the table entries. -r Replace or add data in LDAP. -s Search for data in LDAP. This is the default. -t object Specify the NIS+ object on which to operate. If the object name is not fully qualified, that is, it does not end in a dot, the value of the nisplusLDAPbaseDomain attribute is appended. -v Set the verbose flag. This flag produces extra diagnostic information. -x attr=val... Specify mapping attribute and value pairs to override those obtained by means of the configuration file. Although any attributes defined on NIS+LDAPmapping(4) or rpc.nisd(4) can be specified, the ones that control rpc.nisd(1M) operation have no effect on nisldapmaptest. OPERANDS
The following operands are supported: col=val... NIS+ column and value pairs used to specify which entries should be looked up, added, modified, or deleted. For additions and modifications, use col=val to specify the new values. EXAMPLES
Example 1: Searching for a User Use the following example to search for the user xyzzy in the LDAP container specified for the passwd.org_dir table. example% nisldapmaptest -t passwd.org_dir name=xyzzy Example 2: Listing Table Entries Use the following example to list all entries in the container specified for the services.org_dir table. example% nisldapmaptest -t services.org_dir Example 3: Listing an Object Use the following example to list the services.org_dir object itself, as it is stored in LDAP. example% nisldapmaptest -o -t services.org_dir Example 4: Modifying a Table Entry Use the following example to modify the membership list of the group grp, in the container specified for the group.org_dir table, to be mem1, mem2, and mem3. example% nisldapmaptest -r -t group.org_dir name=grp members=mem1,mem2,mem3 Example 5: Deleting a Table Entry Use the following example to delete the host called bad from the container specified for the hosts.org_dir table. example% nisldapmaptest -d -t hosts.org_dir name=bad EXIT STATUS
The following exit values are returned: 0 The requested operation was successful. != 0 An error occurred. FILES
/var/nis/NIS+LDAPmapping.template /etc/default/rpd.nisd ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnisr | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
rpc.nisd(1M), NIS+LDAPmapping(4), rpc.nisd(4), attributes(5) NOTES
There are several differences between the ways that nisldapmaptest and rpc.nisd operate: 1. nisldapmaptest obtains information about NIS+ by means of the NIS+ API calls, while rpc.nisd looks in its internal database. Thus, if the NIS+ server is not available, nisldapmaptest may be unable to determine NIS+ object types or table column information. 2. While nisldapmaptest can add, modify, or delete LDAP data, it does not modify any NIS+ data. 3. When operating on table entries, if nisldapmaptest is unable to obtain the entry from NIS+, it composes LDAP operations using only the supplied col=val operands. Depending on the mapping used, this can result in extra LDAP operations, for example, attempting to obtain a DN for add, modify, or delete. 4. The default value for nisplusLDAPbaseDomain is the system domain name per sysinfo(2) in nisldapmaptest, but the internal notion of the domain it serves in rpc.nisd. While the two usually are the same, this is not necessarily always the case. 5. When more than one NIS+ entry maps to a single LDAP entry, nisldapmaptest may be unable to perform a complete update, unless you make sure that the col=val specification picks up all relevant NIS+ entries. For example, if you have the services.org_dir NIS+ entries: cname name proto port x x tcp 12345 x y tcp 12345 x z tcp 12345 then specifying cname=x will pick up all three entries and create or modify the corresponding LDAP entry to have three CN values: x, y, and z. However, specifying name=x will match just the first NIS+ entry, and create or modify the LDAP entry to have just one CN: x. SunOS 5.10 5 Dec 2001 nisldapmaptest(1M)
All times are GMT -4. The time now is 11:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy