Sponsored Content
Top Forums Shell Programming and Scripting getting the stanza names if the pattern found Post 302137044 by ghostdog74 on Friday 21st of September 2007 10:00:15 AM
Old 09-21-2007
Code:
awk '/machine/{store=$0}
     /qwerty/ {print store}' "file"

output:
Code:
# ./test.sh
machine1:
machine3:

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern not found : AWK , help

Hi All, My file : $ cat my.txt AA:22:note:AA BB:AA:help:XX CC:14:AA:CC ZZ:AA:hello:AA A) <searching "AA" as 2nd field in all lines of my.txt > $ awk -F ":" '{ if ($2 ~ /AA/) print "found in line - " NR; else print "Not found"}' my.txt Not found found in line - 2 Not found found... (7 Replies)
Discussion started by: jkl_jkl
7 Replies

2. Shell Programming and Scripting

selecting the stanza fields

Hi Friends, I have a stanza file as below : CuDv: name = "hdisk34" status = 0 chgstatus = 3 ddins = "scsidisk" location = "06-08-02" parent = "fscsi0" connwhere = "W_0" PdDvLn = "disk/fcp/mpioosdisk" CuDv: ... (1 Reply)
Discussion started by: vijaya2006
1 Replies

3. Shell Programming and Scripting

Finding Last occurance of another pattern when a pattern is found.

Hi, I have two files viz, rak1: $ cat rak1 rak2: $ cat rak2 sdiff rak1 rak2 returns: I want the lines that got modified, changed, or deleted preceding with the section they are in. I have done this so far: (1 Reply)
Discussion started by: rakeshou
1 Replies

4. UNIX for Dummies Questions & Answers

copying a pattern of files in one directory into other with new pattern names...

Hi, I have to copy a set of files abc* in /path/ to /path1/ as abc*_bkp. The list of files appear as follows in /path/: abc1 xyszd abc2 re2345 abcx .. . abcxyz I have to copy them (abc* files only) into /path1/ as: abc1_bkp abc2_bkp abcx_bkp .. . (6 Replies)
Discussion started by: new_learner
6 Replies

5. Shell Programming and Scripting

search a pattern and if pattern found insert new pattern at the begining

I am trying to do some thing like this .. In a file , if pattern found insert new pattern at the begining of the line containing the pattern. example: in a file I have this. gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies

6. Shell Programming and Scripting

Remove repeating pattern from beginning of file names.

I want a shell script that will traverse a file system starting at specific path. And look at all file names for repeating sequences of and remove them from the file name. The portion of the name that gets removed has to be a repeating sequence of the same characters. So the script would... (3 Replies)
Discussion started by: z399y
3 Replies

7. Shell Programming and Scripting

How to find pattern in file names?

I have some files, those are abbreviated (ed,ea, and bi) company_ed_20100719.txt company_ea_20100719.txt company_bi_20100719.txt I would like to rename these files by replacing ed with EmployeeDetails ea with EmployeeAddress bi with BankInfomration as company_... (3 Replies)
Discussion started by: LinuxLearner
3 Replies

8. Shell Programming and Scripting

If first pattern is found, look for second pattern. If second pattern not found, delete line

I had a spot of trouble coming up with a title, hopefully you'll understand once you read my problem... :) I have the output of an ldapsearch that looks like this: dn: cn=sam,ou=company,o=com uidNumber: 7174 gidNumber: 49563 homeDirectory: /home/sam loginshell: /bin/bash uid: sam... (2 Replies)
Discussion started by: samgoober
2 Replies

9. AIX

Fsize in default: stanza.

The default: stanza in /etc/security/limits is still set to 2097151 on fsize (max file size). I know tar had issues with large files but is there any other reasons for it? I'm thinking yes since it's still set to that by IBM. Cheers, DH (4 Replies)
Discussion started by: Devyn
4 Replies

10. Shell Programming and Scripting

Comparing the pattern of the file names in 2 different directories

Hi, I have got a requirement for which i need your help. The following problem is required to get solved in PERL SCRIPT. Here is the requirement. There are 4 folders say SRC_DIR1, SRC_DIR2 and TGT_DIR_1,TGT_DIR_2 (Note: both path of SRC_DIR1 & SRC_DIR2 are different but both path of... (4 Replies)
Discussion started by: shadow_fawkes
4 Replies
sysconfigdb(8)						      System Manager's Manual						    sysconfigdb(8)

NAME
sysconfigdb - Manage the subsystem configuration database SYNOPSIS
/sbin/sysconfigdb -s /sbin/sysconfigdb {-a | -u} [-t target] -f file subsystem-name /sbin/sysconfigdb {-m | -r} [-t target] -f file [subsystem-name] /sbin/sysconfigdb -d [-t target] subsystem-name /sbin/sysconfigdb -l [-t target] [subsystem-name,...] Specifies a subsystem that contains the attributes you want to modify. The subsystem name and attributes are in a stanza-formatted input file. You must specify only one subsystem name when deleting (-d), adding (-a), or replacing (-u) a subsystem. In other cases, when you do not specify a subsystem name the operation is attempted for all the subsystems and attributes specified in the input file. FLAGS
Adds the specified subsystem entry to the target file. Deletes the specified subsystem entry from the target file. Specifies the input file, a stanza-formatted file that contains entries for one or more subsystems. The default target file is the /etc/sysconfigtab file. Specify another target file by using the -t target flag. Lists the specified subsystem entries in the target file. If you do not specify subsystem-name,... arguments, all subsystem entries in the target file are listed. The /etc/sysconfigtab file is the default target file. Merges subsystem attributes specified in the input file with the subsystem attributes in the target file. If you do not specify a subsys- tem-name argument, all subsystem entries in the input file are merged. The /etc/sysconfigtab file is the default target file. Removes the subsystem entries specified in the input file from the target file. The only entries removed are those which have attribute names and val- ues that exactly match those in the input file. If you do not specify a subsystem-name argument, all subsystem entries in the input file with exactly-matching attributes are removed from the target file. The /etc/sysconfigtab file is the default target database file. Syn- chronizes the /etc/sysconfigtab file and the in-memory configuration database by updating the in-memory database so that it matches the /etc/sysconfigtab file. Specifies the target file for the operation. If you do not specify this flag, the default target file is the /etc/sysconfigtab file. Replaces a subsystem entry in the target file with the subsystem entry specified in the input file. DESCRIPTION
The sysconfigdb command is used to manage the /etc/sysconfigtab subsystem configuration database. However, it can also be used to maintain any text file that has the same format as the /etc/sysconfigtab file. The file being managed by the sysconfigdb command is called the tar- get file. By default, the target file is the /etc/sysconfigtab file. To specify another file as a target file, use the -t file flag. To modify a target file, create an input stanza-formatted file, as described in stanza(4). This stanza file contains the name of one or more subsystems, each with a list of attributes and their values. When the target file is the /etc/sysconfigtab file, modifications you make to it are automatically synchronized into the in-memory subsys- tem configuration database. However, the subsystems are unchanged until the next time they are configured. When the target file is another file, there is no synchronization with the in-memory subsystem configuration database. For example, suppose you create the following file named table_mgr.stanza that defines the attributes for a subsystem named table_mgr_1 and a subsystem named tbl_mgr_2: table_mgr_1: size = 10 name = Ten Element Table tbl_mgr_2: size = 5 name = Five Element Table To add the contents of this file to the /etc/sysconfigtab database and to have those modifications synchronized with the in-memory configu- ration database, enter the following commands: # sysconfigdb -a -f table_mgr.stanza table_mgr_1 # sysconfigdb -a -f table_mgr.stanaz tbl_mgr_2 The above example does not change the value of attributes in the running kernel. To modify the value of attributes in the run- ning kernel you must do one of the following: Use the sysconfig -r command Unconfigure and reconfigure the subsystem that contains the attribute value Reboot your system Always use the sysconfigdb command to modify the /etc/sysconfigtab database as it automatically updates the in-memory copy of the database. This ensures that the kernel has immediate access to any changes. The file is also automatically merged during an update installation and changes will be merged into the new system. To add the contents of the file table_mgr.stanza to another text file named /etc/sampleconfigdb, enter the following command: # sysconfigdb -a -t /etc/sampleconfigdb -f table_mgr.stanza Because the output file is not the /etc/sysconfigtab file, the in-memory configuration data- base is not updated. RESTRICTIONS
You must be the root user to execute the commmand when the /etc/sysconfigtab file is the target file and the operation will modify it. EXAMPLES
The following list shows examples of using the sysconfigdb command: To replace an existing entry in the /etc/sysconfigtab file, use the -u flag: # sysconfigdb -u -f table_mgr.stanza table_mgr_1 The above command replaces the table_mgr_1 entry in the /etc/sysconfigtab file with the information in the table_mgr.stanza file for the table_mgr_1 subsystem. The command updates the in-memory copy of the subsystem configuration database to match the modified /etc/sysconfigtab file. To merge information in a stanza-formatted file with the /etc/sysconfigtab file, use the -m flag: # sysconfigdb -m -f table_mgr.stanza tbl_mgr_2 The above command merges the tbl_mgr_2 information from the table_mgr.stanza file with the information already in the tbl_mgr_2 entry in the /etc/sysconfigtab file. The command updates the in-memory copy of the subsystem configuration database to match the modified /etc/sysconfigtab file. To list the entry for a subsystem in the /etc/sysconfigtab file, use the -l flag: # sysconfigdb -l table_mgr_1 table_mgr_1: size = 10 name = Ten Element Table The above command does not update the in-memory copy of the subsystem configuration database. To delete the entry for a subsystem from the /etc/sysconfigtab file, use the -d flag: # sysconfigdb -d table_mgr_1 The above command deletes the table_mgr_1 entry from the /etc/sysconfigtab file and updates the in-mem- ory copy of the subsystem configuration database to match the modified /etc/sysconfigtab file. FILES
The subsystem configuration database RELATED INFORMATION
Commands: cfgmgr(8) sysconfig(8) Files: sysconfigtab(4), stanza(4) delim off sysconfigdb(8)
All times are GMT -4. The time now is 11:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy