02-11-2011
using sed in shell script
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 between <module-option name="principalDNSuffix">, and </module-option>
Please can some one help me to understand how to achive this using sed.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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)
Discussion started by: Todd88
1 Replies
2. Shell Programming and Scripting
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)
Discussion started by: halola85
6 Replies
3. UNIX for Dummies Questions & Answers
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)
Discussion started by: Dun
1 Replies
4. Shell Programming and Scripting
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)
Discussion started by: o0110o
11 Replies
5. Shell Programming and Scripting
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)
Discussion started by: Muhammad Rahiz
5 Replies
6. UNIX for Dummies Questions & Answers
Hi All,
Below is the script which i have written in cygwin:
#!/usr/bin/sh
fname=$1
cat $fname | sed 's/ //g' > fname1
for i in `cat $fname1`
do
echo $i > file1
#param1 is script name
param1=`awk -F , '{print $1}' file1`
param1="$param1.sql"
#param2 is BL
param2=`awk -F , '{print... (5 Replies)
Discussion started by: janardhanamk
5 Replies
7. Shell Programming and Scripting
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)
Discussion started by: learninfo
5 Replies
8. Programming
Hi, I want to read a file from the command line and remove all the spaces, tabs in it, replacing it with comma(,), and write it to a new file. can you help me out with this scenario. (1 Reply)
Discussion started by: sudhanshu12788
1 Replies
9. Homework & Coursework Questions
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:
Generalize your sub2 script, producing a new script sub3 that will apply a substitution to any number of files... (16 Replies)
Discussion started by: raymondbn
16 Replies
10. Shell Programming and Scripting
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
splashy_update
SPLASHY_UPDATE(1) Splashy POSIX boot splash system SPLASHY_UPDATE(1)
NAME
Splashy - a user-mode, POSIX and LSB compliant, boot splashing system for UNIX.
SYNOPSIS
splashy_update "<text>"
DESCRIPTION
Splashy displays an image and a progress bar at boot time. splashy_update is used to send commands to the running Splashy daemon. See
"COMMANDS" below to know which commands Splashy understands.
OPTIONS
text Sends text to Splashy socket.
COMMANDS
chroot <string>
<string> is a valid path to which Splashy will be chroot'd.
chvt <number>
Switch to vt <number>.
clear Clears the text box area.
CLEAR Same as "clrprint". For compatibility with usplash.
exit Exits Splashy server.
getstring <string>
Makes splashy prompt for a string. The first argument will be the prompt displayed.
getpass <string>
Same as getstring except that the characters typed will no be shown, like in a password box.
progress <number>
Updates the progress bar to <number>%, where N is a number between 0 and 100.
PROGRESS <number>
Same as "progress". For compatibility with usplash.
print <string>
Print <string> in the text box.
scroll <string>
Print <string> in the text box and scroll down.
repaint Redraw the background image.
TEXT <string>
Same as "print". For compatibility with usplash.
SCROLL <string>
Same as "scroll".
timeout <number>
Sets the amount of seconds splashy waits for new commands. If that time is exceeded, it exits.
QUIT Same as "exit". For compatibility with usplash.
RETURN CODES
1 cannot open the socket
2 cannot write to socket
3 invalid args
255 /etc/splashy does not exist
FILES
/etc/splashy/config.xml
Main configuration. defines how splashy should be setup.
SEE ALSO
splashy(1), splashy_config(1), splashy-config.xml(5), splashy-theme.xml(5)
AUTHORS
Andrew Williams <mistik1@geeksinthehood.net>
Luis Mondesi <lemsx1@gmail.com>
perl v5.12.1 2010-07-05 SPLASHY_UPDATE(1)