09-03-2009
Wow that's just awesome! I've been trying different things and never came up with one working. Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How can I use sed to replace a ctrl character such as 'new line' (\0a) to something else? Or any other good command can do this job?
Thanks,
Hillxy (5 Replies)
Discussion started by: hillxy
5 Replies
2. UNIX for Dummies Questions & Answers
hi,
I need to replace all these lines from my text file
123end
234end
324end
234end
989end
258end
924end
At the moment I know how to replace "end". But I want to replace the numbers before end as well. How can I do this ?
sed s/end/newWord/ myfile.txt newFile.txt
thanks (3 Replies)
Discussion started by: aneuryzma
3 Replies
3. Shell Programming and Scripting
Hi everyone
I have file1 contains:
'7832'
' 8765
6543
I want a sed command that will format as:
'7832' , '8765' , '6543'
I tried
sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2
sed -e :a -e '$!N; s/\n/ /; ta' file2
which gives: 7832 8765 6543
I need some help to continue with... (5 Replies)
Discussion started by: nimo
5 Replies
4. Shell Programming and Scripting
Hi
I have written a shell script which used sed code below
sed -i 's/'"$Pattern"'/ /g' $FileName
I want to count the length of Pattern and replace it with equal number of spaces in the FileName.
I have used $(#pattern) to get the length but could not understand how to replace... (8 Replies)
Discussion started by: rakeshkumar
8 Replies
5. Shell Programming and Scripting
Greetings..
getting the error while execution of the script, correct where i am missing
#!/bin/bash
DATE=`date +%Y-%m-%d:::%H:%M`
HOSTNAME=`hostname`
TXT="/log/temp.txt"
LOGPATH="/log1/commanlogs/"
IP=`/sbin/ifconfig | grep -i inet| head -n1| awk '{print $2}'| awk -F : '{print $2}'`... (7 Replies)
Discussion started by: manju98458
7 Replies
6. Shell Programming and Scripting
Hello!
I know that this expression gets rid of non-alphanumeric characters:
sed 's///g'
and I understand that it is replacing them with nothing - hence the '//'-, but I don't understand how it's doing it.
It seems it's finding strings that begin with alphanumeric and replacing them with... (2 Replies)
Discussion started by: bgnersoon2be#1
2 Replies
7. Shell Programming and Scripting
Hello.
Using a bash script , I have a variable name for the file I want to modify
FILE_TO_EDIT="/etc/my_config_file"And I have a variable name for the parameter to change
PARAMETER="fallback_node"
PARAMETER_NEW_VALUE="http://my_server_name.com/new_path"
A config file may contain :
1°)... (2 Replies)
Discussion started by: jcdole
2 Replies
8. Shell Programming and Scripting
I have several files in a directory that look like this:
jacket-n r
potential-n -
outcome-n f
reputation-n b
I want to replace the characters in the second column with certain numbers. For instance, I want the letters 'f', 'r' and 'b' in the second column to replaced with 0 and I want the... (1 Reply)
Discussion started by: owwow14
1 Replies
9. Shell Programming and Scripting
This seems like it should be an easy problem, but for some reason I am struggling with the solution.
I simply want to replace all characters after the first 3 characters with another character, preferably with sed.
Thanks in advance.
Like this, but producing the proper number of *'s:
sed... (30 Replies)
Discussion started by: leolson
30 Replies
10. Shell Programming and Scripting
Hello,
I have some data that looks like the following,
> <SALTDATA> (OVS0199262)
HCl
> <IDNUMBER> (OVS0199262)
OVS0199262
> <SUPPLIER> (OVS0199262)
TimTec
> <EMAIL> (OVS0199262)
info@timtec.net
> <WEBSITE> (OVS0199262)
http://www.timtec.net
I need to remove the data in... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
LEARN ABOUT DEBIAN
dh-exec-illiterate
DH-EXEC-ILLITERATE(1) dh-exec DH-EXEC-ILLITERATE(1)
NAME
dh-exec-illiterate - Write literate debhelper config files!
SYNOPSIS
#! /usr/bin/dh-exec --with=illiterate,subst,install
Greetings, my dear reader, and welcome to the awesome world of
literate programming!
Today, we're going to explore how to write a debhelper install file in
a literate manner. Trust me, it's going to be lots and lots of fun!
So, what exactly are we trying to accomplish? We're going to try
installing a file from `src/this-file' in the source tree, to a
multi-arched path in the binary file. Lets say, to
`/usr/lib/foo/${DEB_HOST_MULTIARCH}/'.
Of course, ${DEB_HOST_MULTIARCH} is a variable, and will be expanded
later in the dh-exec pipeline. It'll be something like
x86_64-linux-gnu.
Furthermore, we want to install all files from the 'usr/lib' directory
under debian/tmp. If we were writing an illiteral install file, we'd
write this rule as:
usr/lib
But the above description is much easier to understand, isn't it?
We're almost finished! One thing left to do, is to install a script
named `rename-me', to `/usr/share/foo/new-name' - we renamed it
in the process!
DESCRIPTION
The dh-exec-illiterate sub-command, unlike the others, does not serve any particular case, except to serve as a warning to all, that things
can be taken to an extreme, even with dh-exec. On the other hand, it is just like the other sub-commands in that it must not be called
directly, but through dh-exec(1), which automatically runs all available sub-commands if run bare; or explicitly with dh-exec
--with=illiterate.
It is a program that will translate its input from pretty much free-form text into something that resembles an install file. At least,
that's the only supported output format for now.
Everything that's not recognised, will be ignored, and not printed. The recognised constructs are:
`source' ... `destination'
The first string between a backtick and a single quote will be treated as the source file, the next such string will be the
destination. If the destination ends with a slash, dh-exec-illiterate will consider it a directory, otherwise it will output a
construct that dh-exec-install can recognise as a rename operation.
'source'
A string, without whitespace, between two single quotes is treated as a source, whose destination is unspecified, and is left up to
dh_install(1) to figure out.
ENVIRONMENT
DH_EXEC_SCRIPTDIR
Indicates which directory the command-specific scripts should be sought for. If not specified, scripts will be searched for in
/usr/share/dh-exec/.
FILES
$DH_EXEC_SCRIPTDIR/dh-exec-illiterate-*
The various scripts for the higher-level program.
SEE ALSO
debhelper(1), dh-exec(1)
AUTHOR
dh-exec-illiterate is copyright (C) 2011-2012 by Gergely Nagy <algernon@madhouse-project.org>.
2012-05-03 DH-EXEC-ILLITERATE(1)