Hi,
I have a problem with a simple script I am trying to write. I want a user to type grep, sed commands that are then stored in variables. Those variables are stored in a function, and the function is then called to execute the commands. The idea is that the user does it step by step.
... (4 Replies)
I have a current code working(named subst1) having a user be able to type this line to substitute words using the sed command:
subst1 old-pattern new-pattern filename
Here is my shell script:
#!/bin/bash
# subst1
ARGS=3
E_BADARGS=65
if
then
echo "Usage: `basename $0`... (1 Reply)
Hey everybody
I need some help on how to order the data in file such as a file have first name last name and city and i would like to order them to in the same order by using sed
thanks alot for your time (6 Replies)
Hi i have a problem how to put som lines on top or in the bottom of the text with sed.
problem is that i am reading from stdin and when i have som lines starting with ++, i have to put some characters on the top of the lines starting with that ++
example of input
oooo
++abcd
++befg... (1 Reply)
Hi folks, maybe somebody here can help me.
I have 2 files. File A and File B. File A contains URLs leading to files on the Internet, with one URL per line; The format of the URLs on each line in File A is .
File B contains only the filenames from each line in File A; One filename per line.
... (11 Replies)
Hi all,
I have files with the following names;
afgcxa.pem4jan.rain.nc
afgcxa.pem4feb.rain.nc
afgcxa.pem4mar.rain.nc
afgcxa.pem4apr.rain.nc
I want to rename them to
afgcxa.pem4-01.jan.rain.nc
afgcxa.pem4-02.feb.rain.nc
afgcxa.pem4-03.mar.rain.nc ... (5 Replies)
Hi,
i want to replace sub text which is in the middle of long text.
let me be more clear with an example.
Here is the actual text in the xml file
<module-option name="principalDNSuffix">,cn=Users,dc=X,dc=Y</module-option>
Now, in the above text, i want to replace all the content lying... (3 Replies)
Generate a ddl file, we have a flat file which contains many commands like REM, CREATE table, TRuncate etc
This script should copy only create table statements to the ddl file.
Create stmts can be in a single or multiple lines.
ex:- INPUT FILE
create table tbl1
(fld1,... (5 Replies)
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:
One problem with the use of sed in simple text substitutions is that sed will intepret some characters as... (1 Reply)
Hi Guys,
I have a xml file as below where I need to find the particular XML tag(<dpath>) and delete the content of it.
<?xml version="1.0" encoding="UTF-8"?>
<title>XML</title><head>Ram</head><ControlCenter><doStatus>1</doStatus></ControlCenter><exitlabel>Gzip... (7 Replies)
Discussion started by: Vinoth Kumar G
7 Replies
LEARN ABOUT DEBIAN
subst
SUBST(1) General Commands Manual SUBST(1)NAME
subst - substitute definitions into file(s)
SYNOPSIS
subst [ -e editor ] -f substitutions victim ...
DESCRIPTION
Subst makes substitutions into files, in a way that is suitable for customizing software to local conditions. Each victim file is altered
according to the contents of the substitutions file.
The substitutions file contains one line per substitution. A line consists of two fields separated by one or more tabs. The first field
is the name of the substitution, the second is the value. Neither should contain the character `#', and use of text-editor metacharacters
like `&' and `' is also unwise; the name in particular is best restricted to be alphanumeric. A line starting with `#' is a comment and
is ignored.
In the victims, each line on which a substitution is to be made (a target line) must be preceded by a prototype line. The prototype line
should be delimited in such a way that it will be taken as a comment by whatever program processes the file later. The prototype line must
contain a ``prototype'' of the target line bracketed by `=()<' and `>()='; everything else on the prototype line is ignored. Subst
extracts the prototype, changes all instances of substitution names bracketed by `@<' and `>@' to their values, and then replaces the tar-
get line with the result.
OPTIONS -e Substitutions are done using the sed(1) editor, which must be found in either the /bin or /usr/bin directories. To specify a dif-
ferent executable, use the ``-e'' flag.
EXAMPLE
If the substitutions file is
FIRST 111
SECOND 222
and the victim file is
x = 2;
/* =()<y = @<FIRST>@ + @<SECOND>@;>()= */
y = 88 + 99;
z = 5;
then ``subst -f substitutions victim'' changes victim to:
x = 2;
/* =()<y = @<FIRST>@ + @<SECOND>@;>()= */
y = 111 + 222;
z = 5;
FILES
victimdir/substtmp.new new version being built
victimdir/substtmp.old old version during renaming
SEE ALSO sed(1)DIAGNOSTICS
Complains and halts if it is unable to create its temporary files or if they already exist.
HISTORY
Written at U of Toronto by Henry Spencer.
Rich $alz added the ``-e'' flag July, 1991.
BUGS
When creating a file to be substed, it's easy to forget to insert a dummy target line after a prototype line; if you forget, subst ends up
deleting whichever line did in fact follow the prototype line.
25 Feb 1990 SUBST(1)