Hi, I'm new at bash scripting -- can anyone here help me about the sed command?
I need to be able to edit and or delete a text from an outside file ie file.txt -- I'm passing a variable and not a string
I was thinking of something like
echo -n "What do you want to edit?: "
read edit
sed... (1 Reply)
Hi All,
I need to pass a variable to perl script from bash script, where in perl i am using if condition. Here is the cmd what i am using in perl
FROM_DATE="06/05/2008"
TO_DATE="07/05/2008"
"perl -ne ' print if ( $_ >="$FROM_DATE" && $_ <= "$TO_DATE" ) ' filename"
filename has... (10 Replies)
Hello,
I am trying the following:
echo __CHANGEME__ >> testfile
VAR1="&&&"
sed -i "s|__CHANGEME__|${VAR1}|" testfile
cat testfile
This results in testfile containing
__CHANGEME____CHANGEME____CHANGEME__
Whereas I want it to result in
&&&
I understand that if
VAR1="\&\&\&"
then... (3 Replies)
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename?
#!/bin/bash
filename=`echo $0`
/usr/bin/sed '/#include/ {
i\
the filename is `$filename`
}' $1
exit 0 (8 Replies)
Hi!
Been working on a script and I've been having a problem. I've finally narrowed it down to this variable I'm setting:
servername=$(awk -v FS=\/ '{ print $7 } blah.txt | sed 's\/./-/g' | awk -v FS=\- '{print $1}')"
This will essentially pare down a line like this:
... (7 Replies)
Hi, wondering if it's been asked before but didn't find matches from google. Basically I have this line:
myvar=$(echo -e "a\tb")
Now somehow the '\t' from the echo output gets replaced with white space and then stored in $myvar.
It creates a problem for me later to use tab as delimiter to do... (2 Replies)
Hi,
Will following set up work in bash script? I've got errors if assigning following binary command to a variable. But on the other hand, COMMAND="ls" works. Any explanation please? How can I assign binary command to a variable COMMAND then I can just call ${COMMAND}?
COMMAND="rsync"... (3 Replies)
I am using a shell script in fedora linux. While calling to the shell I am also passing an argument (var1=0.77) like shown below
sh gossip.sh var1=0.77
in the shell following command is written (which doesn't work)
sed - i -e 's@prob=@prob="$var1";//@g' file.txt
Actually i want the... (7 Replies)
I want to run commands inside a bash script.
An example is
I want to pass the command in a string as regexp as an argument to the script, then run sed on the bash variable
sed.sh regexp
sed.sh "-i \"s/<p>//g\""
then call
sed "$regexp" $fl (3 Replies)
Discussion started by: Kangol
3 Replies
LEARN ABOUT LINUX
shtool-install
SHTOOL-INSTALL.TMP(1) GNU Portable Shell Tool SHTOOL-INSTALL.TMP(1)NAME
shtool-install - GNU shtool install(1) command
SYNOPSIS
shtool install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode mode] [-o|--owner owner]
[-g|--group group] [-e|--exec sed-cmd] file [file ...] path
DESCRIPTION
This command installs a one or more files to a given target path providing all important options of the BSD install(1) command. The trick
is that the functionality is provided in a portable way.
OPTIONS
The following command line options are available.
-v, --verbose
Display some processing information.
-t, --trace
Enable the output of the essential shell commands which are executed.
-d, --mkdir
To maximize BSD compatiblity, the BSD "shtool "install -d"" usage is internally mapped to the "shtool "mkdir -f -p -m 755"" command.
-c, --copy
Copy the file to the target path. Default is to move.
-C, --compare-copy
Same as -c except if the destination file already exists and is identical to the source file, no installation is done and the target
remains untouched.
-s, --strip
This option strips program executables during the installation, see strip(1). Default is to install verbatim.
-m, --mode mode
The file mode applied to the target, see chmod(1). Setting mode to ""-"" skips this step and leaves the operating system default which
is usually based on umask(1). Some file modes require superuser privileges to be set. Default is 0755.
-o, --owner owner
The file owner name or id applied to the target, see chown(1). This option requires superuser privileges to execute. Default is to skip
this step and leave the operating system default which is usually based on the executing uid or the parent setuid directory.
-g, --group group
The file group name or id applied to the target, see chgrp(1). This option requires superuser privileges to execute to the fullest
extend, otherwise the choice of group is limited on most operating systems. Default is to skip this step and leave the operating
system default which is usually based on the executing gid or the parent setgid directory.
-e, --exec sed-cmd
This option can be used one or multiple times to apply one or more sed(1) commands to the file contents during installation.
EXAMPLE
# Makefile
install:
:
shtool install -c -s -m 4755 foo $(bindir)/
shtool install -c -m 644 foo.man $(mandir)/man1/foo.1
shtool install -c -m 644 -e "s/@p@/$prefix/g" foo.conf $(etcdir)/
HISTORY
The GNU shtool install command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1997 for GNU shtool. It was prompted
by portability issues in the installation procedures of OSSP libraries.
SEE ALSO shtool(1), umask(1), chmod(1), chown(1), chgrp(1), strip(1), sed(1).
18-Jul-2008 shtool 2.0.8 SHTOOL-INSTALL.TMP(1)