Sponsored Content
Top Forums Shell Programming and Scripting shell script to edit the content of a file Post 302162745 by tiger99 on Wednesday 30th of January 2008 01:06:51 AM
Old 01-30-2008
Thank you Dennis for the example

There is another substitution I need to do and I am having a lot of trouble getting it to work.

I need to check a file for any line that begins with /database/proc/ and ends with .proc. Then replace the beginning with /online/proc/
i.e.
/database/proc/hello.proc
/database/proc/abc.proc
becomes
/online/proc/hello.proc
/online/proc/abc.proc

I wrote the following script. However, it doesn't return anything.
Could someone please help me? Why isn't my code working?

Code:
sed -e '/database/proc/*.proc!/s!/database/proc!/online/proc!g' test_file | grep online/proc >> new_file

Thanks in advance for any advice/help
 

10 More Discussions You Might Find Interesting

1. AIX

How to edit txt file by shell script?

What I want to do is just delete some lines from a text file, I know it's easy using copy and redirect function, but what I have to do is edit this file (delete the lines) directly, as new lines may be added to the text file during this period. Can AIX do this ? # cat text 1:line1 2:line2... (3 Replies)
Discussion started by: dupeng
3 Replies

2. Shell Programming and Scripting

Edit a config file using shell script

I need to edit a config file using shell script. i.e., Search with the 'key' string and edit the 'value'. For eg: below is what I have in the config file "configfile.cfg". Key1=OldValue1 Key2=OldValue2 I want to search for "Key1" and change "OldValue1" to "NewValue1" Thanks for your... (7 Replies)
Discussion started by: rajeshomallur
7 Replies

3. Shell Programming and Scripting

shell script to edit file and delete entry

Can anyone provide me a shell script to edit a xml file and delete one entry. To do manually i can edit(vi editor) the file and 'dd' will delete the file.But I wiluld to know if I can do with a script. Thanks in advance Tannu (6 Replies)
Discussion started by: tannu
6 Replies

4. Shell Programming and Scripting

Script to Edit the file content and create new file

I have a requirement, which is as follows *. Folder contains list of xmls. Script has to create new xml files by copying the existing one and renaming it by appending "_pre.xml" at the end. *. Each file has multiple <Name>fileName</Name> entry. The script has to find the first occurance of... (1 Reply)
Discussion started by: sudesh.ach
1 Replies

5. Shell Programming and Scripting

Script to Check & Edit Content of a file (Addition of comma in each lines of code)

Hi all, I need to write an automated bash shell script which performs such operations: 1. Grep the header of everyline with the initial of "T" in "FILE_A" 2. Perform a for loop, Count the numbers of comma in the line of code, if (no. of comma < 17) ADD the comma until 17; ... (2 Replies)
Discussion started by: big_nutz
2 Replies

6. Shell Programming and Scripting

Shell script to edit a file

Hello, I have a big file in wich I would like to rename inside this exactly the string '_ME' and not rename in case we have 'ABC_MELANGE'. Is there a way to do it by using a shell script? Any tip will be apreciated. The file is like described bellow, after using command more filename : ... (3 Replies)
Discussion started by: Titas
3 Replies

7. Shell Programming and Scripting

shell script to edit a file

i have a file called number which contains data as 1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 needed a shell script to print the output as 1 7 7 1 4 and (2 Replies)
Discussion started by: jacky29
2 Replies

8. Shell Programming and Scripting

Automating using shell script : edit the file in a directory

I am trying to automate hadoop installation procedure using shell script. It involves go to perticular directory and add some more lines to the file /etc/sysctl.conf. How this can be done? Regards Navaz (1 Reply)
Discussion started by: Abdul Navaz
1 Replies

9. Homework & Coursework Questions

Edit the file in shell script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to automate hadoop installation procedure using shell script. It involves go to perticular directory... (3 Replies)
Discussion started by: Abdul Navaz
3 Replies

10. Shell Programming and Scripting

Open and edit a file using a shell script

Hello Folks, I have a file named as date.dat present at /tmp/abc location which has following data - 20161030,20161031,20161101 I need to remove this line and replace it with something like below - $param1,$param2,$param3 Param1, Param2 and param3 stores the date based on some calculation in... (1 Reply)
Discussion started by: ektubbe
1 Replies
FOP(1)								   User Commands							    FOP(1)

NAME
fop - Command line wrapper for the java version of fop. DESCRIPTION
Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent format- ter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output for- mats currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF. SYNOPSIS
fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile> OPTIONS
-version print FOP version and exit -d debug mode -x dump configuration settings -q quiet mode -c cfg.xml use additional configuration file cfg.xml -l lang the language to use for user information -r relaxed/less strict validation (where available) -dpi xxx target resolution in dots per inch (dpi) where xxx is a number -s for area tree XML, down to block areas only -v run in verbose mode (currently simply print FOP version and continue) -o [password] PDF file will be encrypted with option owner password -u [password] PDF file will be encrypted with option user password -noprint PDF file will be encrypted without printing permission -nocopy PDF file will be encrypted without copy content permission -noedit PDF file will be encrypted without edit content permission -noannotations PDF file will be encrypted without edit annotation permission -a enables accessibility features (Tagged PDF etc., default off) -pdfprofile prof PDF file will be generated with the specified profile (Examples for prof: PDF/A-1b or PDF/X-3:2003) -conserve Enable memory-conservation policy (trades memory-consumption for disk I/O) (Note: currently only influences whether the area tree is serialized.) INPUT
infile xsl:fo input file (the same as the next) (use '-' for infile to pipe input from stdin) -fo infile xsl:fo input file -xml infile xml input file, must be used together with -xsl -atin infile area tree input file -ifin infile intermediate format input file -imagein infile image input file (piping through stdin not supported) -xsl stylesheet xslt stylesheet -param name value <value> to use for parameter <name> in xslt stylesheet (repeat '-param name value' for each parameter) -catalog use catalog resolver for input XML and XSLT files OUTPUT
outfile input will be rendered as PDF into outfile (use '-' for outfile to pipe output to stdout) -pdf outfile input will be rendered as PDF (outfile req'd) -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b") -awt input will be displayed on screen -rtf outfile input will be rendered as RTF (outfile req'd) -pcl outfile input will be rendered as PCL (outfile req'd) -ps outfile input will be rendered as PostScript (outfile req'd) -afp outfile input will be rendered as AFP (outfile req'd) -tiff outfile input will be rendered as TIFF (outfile req'd) -png outfile input will be rendered as PNG (outfile req'd) -txt outfile input will be rendered as plain text (outfile req'd) -at [mime] out representation of area tree as XML (outfile req'd) specify optional mime output to allow the AT to be converted to final format later -if [mime] out representation of document in intermediate format XML (outfile req'd) specify optional mime output to allow the IF to be converted to final format later -print input file will be rendered and sent to the printer see options with "-print help" -out mime outfile input will be rendered using the given MIME type (outfile req'd) Example: "-out application/pdf D:out.pdf" (Tip: "-out list" prints the list of supported MIME types) -svg outfile input will be rendered as an SVG slides file (outfile req'd) Experimental feature - requires additional fop-sandbox.jar. -foout outfile input will only be XSL transformed. The intermediate XSL-FO file is saved and no rendering is performed. (Only available if you use -xml and -xsl parameters) EXAMPLES
fop foo.fo foo.pdf fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf fop -xml foo.xml -xsl foo.xsl -foout foo.fo fop -xml - -xsl foo.xsl -pdf - fop foo.fo -mif foo.mif fop foo.fo -rtf foo.rtf fop foo.fo -print fop foo.fo -awt HYPENATION
fop can make use of external hyphenation rules that can be supplied in the form of a hyphenation jar. You can find such a one at http://offo.sourceforge.net/. To actually use that, set the FOP_HYPHENATION_PATH environment variable to the full path of this file, or use configuration files, see below. CONFIGURATION FILES
fop reads two configuration files on startup: /etc/fop.conf and $HOME/.foprc. These are plain shell script files where you can define for instance the FOP_HYPHENATION_PATH variable. JAVA-WRAPPERS NOTE This program is a shell script wrapper based on java-wrappers(7). You therefore benefit from several features; please see the java-wrap- pers(7) manual page for more information about them. AUTHOR
Wrapper author: Ola Lundqvist <opal@debian.org> This manual page was written by Mathieu Malaterre <mathieu.malaterre@gmail.com>, for the Debian project (and may be used by others). SEE ALSO
fop-ttfreader(1), java-wrappers(7). fop Version 1.0 January 2012 FOP(1)
All times are GMT -4. The time now is 04:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy