Sponsored Content
Top Forums Shell Programming and Scripting How to search and append words in the same file using unix scripting file operations Post 302579511 by gsreeni on Monday 5th of December 2011 11:20:29 PM
Old 12-06-2011
How to search and append words in the same file using unix scripting file operations

Hi ,

I have a file myhost.txt which contains below,

127.0.0.1 localhost
1.17.1.5 atrpx958
11.17.10.11 atrpx958zone nsybhost

I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone.

How to search the word atrpx958(which is hostname) only, in the file and append the words in the same file.

How can we do it using unix scripting file operations to acheive this..

Thanks in advance.

--Sree
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search for words in file

hi all, i would like to search in a directory. all files they were found shoul be opend and looked about a keyword. if keyword is found i want to see the name of the file. i've rtfm of find and have a command like this : find /etc -exec cat \{}\ | grep KEYWORD but don't work, and : find... (4 Replies)
Discussion started by: Agent_Orange
4 Replies

2. Shell Programming and Scripting

Unix file operations(shell script)

Hi, I want to compare two files. Files will look like as follows: file1: ASDFGHJU|1234567890123456 QWERTYUI|3456789098900890 file2: ZXCVBVNM|0987654321234567 POLKIJUYH|1234789060985478 output file should be: ASDFGHJU|1234567890123456 QWERTYUI|3456789098900890 Thnaks in advance (6 Replies)
Discussion started by: nivas
6 Replies

3. Shell Programming and Scripting

Unix File operations

Hi, Iam having the two files as follows: file1: ASQWEDFR09876543121234512 POIUYTREW09876512345676788 ZXCVBNMKS1209888888888888 file2: ASQWEDFR09876543121234516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- CXADFGTU09876543121234789 asdcvfgbtg@abc.com ... (14 Replies)
Discussion started by: nivas
14 Replies

4. Shell Programming and Scripting

file operations in shell scripting

hi All, my query... 1.I Have to search for the files in the root directory. 2.i have to search for a pattern in all the files in the root directory and then replace them with a new pattern. 3.Rename the file Explanation: if ABC is the root folder and has 3 subfolders and there are 15... (9 Replies)
Discussion started by: adityamahi
9 Replies

5. UNIX for Dummies Questions & Answers

search words in different file

Hi, I have 1 - 100 file I want the list of such file which contains word 'internet' Please provide command to do this (3 Replies)
Discussion started by: kaushik02018
3 Replies

6. Shell Programming and Scripting

How to search and append words in a file

Hi , I have a file myhost.txt which contains below, 127.0.0.1 localhost 1.17.1.5 atrpx958 11.17.10.11 atrpx958zone nsybhost I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone. How to search the word atrpx958 only in... (2 Replies)
Discussion started by: gsreeni
2 Replies

7. Shell Programming and Scripting

Search id from second file and append in first

Hello, I want to search a string/substring from the second column in file in another file and append the first found record in second file to the end of the record in the first file. Both files are tab delimited. All lines with KOG in col13 do not need to be searched as it will not be... (7 Replies)
Discussion started by: gina.lizar
7 Replies

8. UNIX for Dummies Questions & Answers

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display... (1 Reply)
Discussion started by: 12ic11
1 Replies

9. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display which volume pool a given... (1 Reply)
Discussion started by: 12ic11
1 Replies

10. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi Don, this is not homework question. I work for a Credit card company and my development goal this year is to learn Unix. I would love if others can help me get started, thanks. Hi everyone I am new to Unix and need help writing a script that can ask user for an input, then search that input... (2 Replies)
Discussion started by: 12ic11
2 Replies
bsmconv(1M)                                               System Administration Commands                                               bsmconv(1M)

NAME
bsmconv, bsmunconv - enable or disable the Basic Security Module (BSM) on Solaris SYNOPSIS
/etc/security/bsmconv [rootdir...] /etc/security/bsmunconv [rootdir...] DESCRIPTION
The bsmconv and bsmunconv scripts are used to enable or disable the BSM features on a Solaris system. The optional argument rootdir is a list of one or more root directories of diskless clients that have already been configured. See smdiskless(1M). To enable or disable BSM on a diskless client, a server, or a stand-alone system, logon as super-user to the system being converted and use the bsmconv or bsmunconv commands without any options. To enable or disable BSM on a diskless client from that client's server, logon to the server as super-user and use bsmconv, specifying the root directory of each diskless client you wish to affect. For example, the command: myhost# bsmconv /export/root/client1 /export/root/client2 enables BSM on the two machines named client1 and client2. While the command: myhost# bsmconv enables BSM only on the machine called myhost. It is no longer necessary to enable BSM on both the server and its diskless clients. After running bsmconv the system can be configured by editing the files in /etc/security. Each diskless client has its own copy of configu- ration files in its root directory. You might want to edit these files before rebooting each client. Following the completion of either script, the affected system(s) should be rebooted to allow the auditing subsystem to come up properly initialized. FILES
The following files are created by bsmconv: /etc/security/device_maps Administrative file defining the mapping of device special files to allocatable device names. /etc/security/device_allocate Administrative file defining parameters for device allocation. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsr | +-----------------------------+-----------------------------+ SEE ALSO
auditconfig(1M), auditd(1M), audit_startup(1M), audit.log(4), audit_control(4), attributes(5) NOTES
bsmconv and bsmunconv are not valid in a non-global zone. SunOS 5.10 26 May 2004 bsmconv(1M)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy