Sponsored Content
Top Forums Shell Programming and Scripting KSH - search for string and insert line above Post 302319545 by colemar on Monday 25th of May 2009 02:06:02 PM
Old 05-25-2009
process_the_file a_file > a_file

This is a common error, it cannot work since the shell evaluates > a_file before to start the command, therefore a_file is emptied before any work.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Failed to insert string into file before line

Hi folks, I have the following program: #! /bin/ksh set -xv export grepDataSource="</data-sources>" export DB_HOST=tornado export SCHEMA_NAME=IAS10G export dataSource=data-sources.xml sourceString="<data-source class=\"oracle.jdbc.pool.OracleConnectionCacheImpl\" name=\"RiGHTvDS\"... (7 Replies)
Discussion started by: nir_s
7 Replies

2. Shell Programming and Scripting

how to insert line break + string in vi (search & replace )

Hello all i have big test file that has allot of structure text something like this : <foo1 *.html> <blah action> somthing 1 somthing 2 </blah> </foo1 > now i will like to insert 2 more lines of text below the <blah action> so it will be like : <foo1... (1 Reply)
Discussion started by: umen
1 Replies

3. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

4. Shell Programming and Scripting

search a line and insert string into specific at position

Hi, guys. I have one question: How can I search for a line with certain string in it and then insert a string into this line? For example: There is a file called shadow, the contents of it are below: ************************** ... yuanz:VIRADxMsadfDF/Q:0:0:50:7:::... (9 Replies)
Discussion started by: daikeyang
9 Replies

5. Shell Programming and Scripting

how to insert a string as a first line of the file

Hi I need to update a number of existing files and insert #!/bin/ksh line a the first line of the file. Is there any awk or sed command which would help me to do that instead of doing it manually? Thanks a lot -A (10 Replies)
Discussion started by: aoussenko
10 Replies

6. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

7. Shell Programming and Scripting

Awk, if line after string does not match insert

I have a large file with interface records. I need to check every record that has the string "encapsulation bridge1483" and if the next line after this does not have "ip description" then I need to insert a line to add "ip description blah_blah_blah. Sample file: interface atm 1/0.190158... (3 Replies)
Discussion started by: numele
3 Replies

8. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

9. Shell Programming and Scripting

Insert String every n lines, resetting line counter at desired string

I need to read a text file and insert a string every n lines, but also have the line counter restart when I come across a header string. Line repeating working every 3 lines using code: sed '0~3 s/$/\nINSERT/g' < INPUT/PATH/FILE_NAME.txt > OUTPUT/PATH/FILE_NAME.txt I cannot seem to find... (1 Reply)
Discussion started by: Skonectthedots
1 Replies

10. Shell Programming and Scripting

Insert line based on found string

Hi All I'm trying to insert a new line at the before each comment line in a file. Comment lines start with '#-----' there are other comments with in lines but I don't want a new line there. Example file: blah blah #do not insert here #this is a comment blah #some more #another comment... (10 Replies)
Discussion started by: Mudshark
10 Replies
ffm(4)							     Kernel Interfaces Manual							    ffm(4)

NAME
ffm - File-on-File Mounting File System STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fattach(): XSH4.2 fdetach(): XSH4.2 Refer to standards(5) for more information about industry standards and their associated tags. DESCRIPTION
The File-on-File Mounting (FFM) file system allows regular files, character device special files, or block device special files to be mounted on regular files or directories. The ffm file system is used with the System V Release 4-compatible library functions fattach(3) and detach(3) to enable a user process to have one file descriptor pointing to the data associated with a named file and a named STREAM. When one name is active, the other name is invisible. For example, a user application mounts a file descriptor from a file named a_file on a file that is named b_file. The file descriptor of file a_file is accessible by two names, a_file and b_file. However, when the user application attempts to open either file, only the file descriptor for a_file is returned: the file descriptor for b_file is invisible while a_file is mounted over it. The fattach(3) function mounts a file over another; the fdetach(3) function removes the association so the underlying file can be accessed. The user process can also mount a regular file over a regular file in order for it to be a clone of the underlying file. [Do not confuse this clone with an AdvFS clone fileset.] In this case, the clone file is a character device special file that is associated with a device driver that handles such files. As a result, a user can specify one clone entry and then open this device multiple times. Each time the device is opened, a new vnode is obtained but exactly the same device behavoir is also obtained: the behavior is cloned. That mount occurs if the -o clone option is used in the mount command or as an element of a ffm line in the /etc/fstab file. In this case, there are two files with identical contents, separate names, and separate file descriptors. EXAMPLES
The following example shows an ffm mount of a_file on b_file. If the du command were executed, its display would show a_file in the file system column and b_file in the Mounted on column: # mount -t ffm a_file b_file The following example shows an ffm mount of a_file on b_file, with the mount -o clone option specifying that a_file is a clone of b_file. # mount -t ffm -o clone a_file b_file RESTRICTIONS
The user process must be the root user or must be the owner of the files and must have write permissions for the files. [Tru64 UNIX] Before you can use the ffm file system, you must configure the kernel option FFM_FS into the kernel. See System Administra- tion for information about configuring the kernel. RELATED INFORMATION
Commands: fdetach(8), mount(8) Functions: fattach(3), fdetach(3), isastream(3), chmod(2), mount(2) Interfaces: streamio(7) Files: fstab(4) Standards: standards(5) delim off ffm(4)
All times are GMT -4. The time now is 11:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy