Sponsored Content
Top Forums Shell Programming and Scripting Replace content from a file and save Post 302968292 by Don Cragun on Monday 7th of March 2016 03:30:23 PM
Old 03-07-2016
Try:
Code:
ed -s qm.ini <<-EOF
	g/LogBufferPages=0/s//LogBufferPages=4096/g
	w
	q
EOF

or:
Code:
ex -s qm.ini <<-EOF
	g/LogBufferPages=0/s//LogBufferPages=4096/g
	w
	q
EOF

On some systems, these might also rename the temp file to overwrite your original file (thereby changing the file's owner), but on most systems I think at least ed still does just what you ask it to do (rewrite the contents of the file instead of replace the file).
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace a string with content from another file

Hi, I'm a newbi in shell script. Here what I want to do: FileA: bor bor bor xxxx bib bib bi FileB: something something something I want to replace string "xxxx" in FileA with contents of FileB. i tried with sed: fileb=`cat FileB` reg=xxxx file=FileA (4 Replies)
Discussion started by: afatguy
4 Replies

2. Shell Programming and Scripting

replace character in a string pattern and save the change in same file

I am facing one problem, can any one please suggest me the command for the same in unix. I am using Ksh. I have a large file with the data that looks like below. "ROTO2-2007f","_US01","9/15/2007","9/21/2007",346492,"NICK, LCD WATCH"97,1,"NAPOLITJ ","BERGER,M Z & CO INC",0.01, ... (2 Replies)
Discussion started by: mihir0011
2 Replies

3. Shell Programming and Scripting

How to replace some content of a file and write with a new name

Hi I have a control file which looks like this LOAD DATA INFILE '/home/scott/XXX.dat' PRESERVE BLANKS ............. ............. how can i change the content of this file and replace the file in the second line with anothe file name and write it back with another name to the disk? ... (5 Replies)
Discussion started by: mwrg
5 Replies

4. Shell Programming and Scripting

Read file and for each line replace two variables, add strings and save output in another file

Hi All, I have a file, let's call it "info.tmp" that contains data like this .. ABC123456 PCX333445 BCD789833 I need to read "info.tmp" and for each line add strings in a way that the final output is put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)' where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies

5. Shell Programming and Scripting

Replace string by file content

hi I have template file my.tpl: bla-bla-bla <link href="style.css" type="text/css"> bla-bla-bla and style.css : body{margin: 0px;} I want to get in result one file: bla-bla-bla <script>body{margin: 0px;}</script> bla-bla-bla I tryed to used SED: sed '/<link .*href=\"(*)*\"... (6 Replies)
Discussion started by: dim_nsk
6 Replies

6. Shell Programming and Scripting

Need to replace particular content in a xml file

Hi, My requirement is to find a text and replace it with another in a XML file. I am new to Unix,Please provide some suggestion to achieve. Find: <Style ss:ID="ColumnHeader1"> Replace with: <Style ss:ID="ColumnHeader1"> <Borders> <Border ss:Position="Bottom"... (4 Replies)
Discussion started by: cnraja
4 Replies

7. Shell Programming and Scripting

Sed: replace content from file with the content from file

Hi, I am having trouble while using 'sed' with reading files. Please help. I have 3 files. File A, file B and file C. I want to find content of file B in file A and replace it by content in file C. Thanks a lot!! Here is a sample of my question. e.g. (file A: a.txt; file B: b.txt; file... (3 Replies)
Discussion started by: dirkaulo
3 Replies

8. Shell Programming and Scripting

How to replace multiple file content?

Hi Gurus, I need replace multiple files content. the file name pattern likes currentfile_code_* the content pattern in the file like text=value I need replace the content as text=abcde Thanks in advance (7 Replies)
Discussion started by: ken6503
7 Replies

9. Shell Programming and Scripting

How to save sorted content of a inside the same file?

Hi All, When i use sort Test, here is the output: $ sort Test a b b c d e f g h i But the contents in the file remain unsorted, how to do that? ]$ cat Test g i (6 Replies)
Discussion started by: chandrakanth
6 Replies

10. Shell Programming and Scripting

awk : split file and rename and save in path according to content

Hello, I'm using Windows 7 ; sed, awk and gnuwin32 are installed. I have a big text file I need to manipulate. In short, I will have to split it in thousands of short files, then rename and save in a folder which name is based upon filename. Here is a snippet of my big input.txt file (this... (4 Replies)
Discussion started by: sellig
4 Replies
metacity(1)                                                        User Commands                                                       metacity(1)

NAME
metacity, metacity--theme-viewer - GNOME desktop window manager, theme viewer for the metacity window manager themes SYNOPSIS
metacity [--sm-disable] [--sm-save-file=filename] [--display=display] [--replace] [--version] metacity-theme-viewer [theme-name] DESCRIPTION
metacity is a fully integrated window manager that uses GTK+ for UI elements. metacity communicates closely with the panel and other desk- top elements. To configure metacity, use the GNOME preferences dialogs. metacity-theme-viewer is an application for testing and displaying metacity themes. OPTIONS
The following options are supported: --display=displaSpecify the remote X Display to be used by the window manager, where display is in the following format: hostname:displaynumber.screennumber --help Display detailed usage message. You can also use -? to specify this option. --replace A metacity started with the ---replaceoption will replace an existing metacity. --sm-disable Disable the connection to the session manager. --sm-save-file=fSpecifies the session management file to be used. By default, the $HOME/.metacity/sessions file is used. --version Display the version information for the metacity command. OPERANDS
The following operands are supported: -theme-name Specifies the theme that metacity should use. If no theme is specified on the metacity-theme-viewer command line, metacity loads the Crux theme. An error message is displayed if the theme does not exist. EXAMPLES
Example 1: Starting metacity From the Command Line When a metacity is Already Running example% metacity --replace Example 2: Starting metacity With a Non-Default Session Management File example% metacity --sm-save-file=filename EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/metacity The command-line executable for the application. /usr/bin/metacity--themeTheecommand-line executable for the application. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-wm | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. NOTES
Written by Laszlo Kovacs, Sun Microsystems Inc., 2003. SunOS 5.10 2 Oct 2003 metacity(1)
All times are GMT -4. The time now is 10:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy