Sponsored Content
Full Discussion: Insert text using sed
Top Forums Shell Programming and Scripting Insert text using sed Post 302608165 by Scrutinizer on Friday 16th of March 2012 10:16:36 AM
Old 03-16-2012
Code:
sed 's/[^,]*/TEST/64' file

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Insert Text With Sed

Hello. Trying to insert text at line 1 and after last line of file. I have searched posts but nothing seems to work. I keep getting extra characters error or nothing gets inserted into the file. #!/bin/sh touch textfile.txt sed 'i\ Add this line before every line with WORD' textfile.txt ... (5 Replies)
Discussion started by: steveramsey
5 Replies

2. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

3. Shell Programming and Scripting

sed insert text at particular line

I know that sed -n '12p' file will print line 12 but how might I insert text to a specified line? thanks (2 Replies)
Discussion started by: action_owl
2 Replies

4. Shell Programming and Scripting

Insert text with Sed (in various positions)

Hello. I'm trying to insert text in various positions and I could only do that using pipes for each position. Example: cat file | sed -e 's#\(.\{5\}\)\(.*\)#\1:\2#g' | sed -e 's#\(.\{26\}\)\(.*\)#\1:\2#g' Insert ":" at position 5 and 26. it can be done in the same sentence, without using... (4 Replies)
Discussion started by: </kida>
4 Replies

5. Shell Programming and Scripting

sed insert text without newline

Hi, I use sed to insert text at beginning of a file. But sed inserts a newline after my text that I do not need. For example, I want to insert "foo" at the beginning of my file: > cat myfile This is first line. > sed -i '1i\foo' myfile > cat myfile foo This is first line. ... (5 Replies)
Discussion started by: tdw
5 Replies

6. Shell Programming and Scripting

Using sed to insert text file at first line

sed '1r file.txt' <source.txt >desti.txt This example will insert 'file.txt' between line 1 and 2 of source.txt. sed '0r file.txt' <source.txt >desti.txt gives an error message. Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Discussion started by: psve
18 Replies

7. Shell Programming and Scripting

sed to insert a slash and keep text

I have: /path/to/my/fixdir/MD1234567.tar I want to have: /path/to/my/fixdir/MD/1234567.tar fixdir never changes but MD does and how many numerical digits does. I want something like: /usr/bin/sed 's/fixdir\/../fixdir\/..\//' This ends up: /path/to/my/fixdir/../1234567.tar But... (3 Replies)
Discussion started by: crowman
3 Replies

8. Shell Programming and Scripting

sed insert text 2 lines above pattern

Hi I am trying to insert a block of text 2 lines above a pattern match using sed eg #Start of file entry { } #End of file entry new bit of text has to be put in just above the } eg #Start of file entry { New bit of text } #End of file entry (7 Replies)
Discussion started by: eeisken
7 Replies

9. Shell Programming and Scripting

How do I insert text with sed ?

Hi I was wondering if anyone new of a solution to this problem? I need to copy a time stamp that is on a line of .text in a text file into multiple positions on the same line. I need to insert the time stamp on the same line between every occurance of the text ".pdf_.html" right after the... (9 Replies)
Discussion started by: Paul Walker
9 Replies

10. Shell Programming and Scripting

Using sed to insert text between lines

Hello, I am trying to insert a section of text between lines in another text file. The new lines to be inserted are: abcd.efgh.zzzz=blah abcd.efgh.xxxx=blah Where N = 0 to 2 Original File: abcd.efgh.wwxx=aaaaa abcd.efgh.yyzz=bbbbb abcd.efgh.wwxx=aaaaa abcd.efgh.yyzz=bbbbb... (3 Replies)
Discussion started by: tsu3000
3 Replies
Apache::TestMM(3)					User Contributed Perl Documentation					 Apache::TestMM(3)

NAME
Apache::TestMM - Provide MakeMaker Wrapper Methods SYNOPSIS
require Apache::TestMM; # import MY::test and MY::clean overrides for MM Apache::TestMM->import(qw(test clean)); # parse command line args Apache::TestMM::filter_args(); # autogenerate the script Apache::TestMM::generate_script('t/TEST'); DESCRIPTION
"Apache::TestMM" provides wrappers for the "ExtUtils::MakeMaker" craft, making it easier to extend the autogenerated Makefile with "Apache::Test". FUNCTIONS
"import" use Apache::TestMM qw(test clean); or: Apache::TestMM->import(qw(test clean)); Imports "MY::" overrides for the default "ExtUtils::MakeMaker" test and clean targets, as if you have defined: sub MY::test {...} sub MY::clean {...} in Makefile.PL. "Apache::TestMM" does this for you so that these Makefile targets will run the Apache server and the tests for it, and clean up after its mess. "filter_args" push @ARGV, '-apxs', $apxs_path; Apache::TestMM::filter_args(); WriteMakefile(...); When "WriteMakefile()" is called it parses @ARGV, hoping to find special options like "PREFIX=/home/stas/perl". "Apache::Test" accepts a lot of configuration options of its own. When "Apache::TestMM::filter_args()" is called, it removes any "Apache::Test"-specific options from @ARGV and stores them internally, so when "WriteMakefile()" is called they aren't in @ARGV and thus won't be processed by "WriteMakefile()". The options can be set when Makefile.PL is called: % perl Makefile.PL -apxs /path/to/apxs Or you can push them manually to @ARGV from the code: push @ARGV, '-apxs', $apxs_path; When: Apache::TestMM::generate_script('t/TEST'); is called, "Apache::Test"-specific options extracted by "Apache::TestMM::filter_args()" are written to the autogenerated file. In our example, the autogenerated t/TEST will include: %Apache::TestConfig::Argv = qw(apxs /path/to/apxs); which is going to be used by the "Apache::Test" runtime. The other frequently used options are: "-httpd", telling where to find the httpd (usually when the "-apxs" option is not used), "-libmodperl" to use a specific mod_perl shared object (if your mod_perl is built as DSO), "-maxclients" to change the default number of the configured "MaxClients" directive, "-port" to start the server on a specific port, etc. To get the complete list of available configuration options and their purpose and syntax, run: % perl -MApache::TestConfig -le 'Apache::TestConfig::usage()' You may wish to document some of these in your application's README file, especially the "-apxs" and "-httpd" options. "generate_script" Apache::TestMM::generate_script('t/TEST'); "generate_script()" accepts the name of the script to generate and will look for a template with the same name and suffix .PL. So in our example it'll look for t/TEST.PL. The autogenerated script t/TEST will include the contents of t/TEST.PL, and special directives, including any configuration options passed via "filter_args()" called from Makefile.PL, special fixup code, etc. perl v5.18.2 2015-06-18 Apache::TestMM(3)
All times are GMT -4. The time now is 08:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy