06-23-2011
I generally use either \ or cntrl-v or \ + cntrl-v in front of enter for cr or nl in vi, aka 'visual ex', in ':' mode, which is raw 'ex', which is extended 'ed'.
BTW, sed, the stream editor, likes \n in regex (from field of substitute s) and \ + linefeed in substitute s to field, treats cr as a literal.
The other versions of vi (ex) and sed may honor \r and \n in other contexts, but as you note, it is spotty.
You can install in your own home dir a GNU version of vi and sed, and put it up-PATH to have a consistent home world. If on another ID, having your personal tools in a directory is handy, as you can add the dir up-PATH while you are there to get to your tools. You have to write scripts that do not assume your ID. You can share the tools to others easily, too. You just have to use the old tool where you cannot get to your version and in prod scripts.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
I have this script which gives me the result...
#! /usr/bin/sh
set -x
cd /home/managar
a=1
while true
do
if
then
echo " File log.txt exists in this directory "
exit 0
fi
echo " File has not arrived yes..."
sleep 3
let a=a+1
if
then (1 Reply)
Discussion started by: mgirinath
1 Replies
2. Shell Programming and Scripting
I have written a shell script which looks like below:
grep -v ',0,' ./DATA/abc.001 > ./DATA/abc.mid
egrep $GREPSEARCH ./DATA/ebc.mid > ./DATA/abc.cut
the variable GREPSEARCH has values like the below:
... (3 Replies)
Discussion started by: igandu
3 Replies
3. Shell Programming and Scripting
Hi,
I have a script in which an entry like this .....
FILENAME_B="PIC_${DATE}0732*.JPG"
The script connects to an ATM and pull a pic file from it.The format for the file is like PIC_2008061400000001.JPG in the ATM.
Means 1st 8 digit is the date(YYYYMMDD) field
2nd 8 digit means hrs... (2 Replies)
Discussion started by: Renjesh
2 Replies
4. Shell Programming and Scripting
Hi all
Here I came accross a situation which i am unable to reason out...
snippet 1
psg ServTest | grep -v "grep" | grep -v "vi" | awk '{
pgm_name=$8
cmd_name="ServTest"
gsub(/]*/,"",pgm_name)
if(pgm_name==cmd_name) { print "ServTest Present =" cmd_name}
}'... (10 Replies)
Discussion started by: Anteus
10 Replies
5. Shell Programming and Scripting
Hi All
I have a flat text file. Each line in it contains a "/full path/filename". The last three columns are predictable, but directory depth of each line varies.
I want to sort on the last three columns, starting from the last, 2nd last and 3rd last. In that order. The last three columns... (6 Replies)
Discussion started by: JakeKatz
6 Replies
6. HP-UX
Hi,
I am using HP-UX B.11.23 U ia64
I am trying to retrieve files using -mtime option of find command
However I found that -mtime is not giving correct results
Following is the output of commands executed on 03-Dec-2009
It can be seen that -mtime +1 should have returned all... (2 Replies)
Discussion started by: Chetanaz
2 Replies
7. UNIX for Dummies Questions & Answers
Hello,
I am writing a small one liner script to display the tables in my database.
I am working with Centos 5.5 and postgresql
the command is
"psql -c "\dt" | awk '{print$3}'"
I just want the 3rd column from the result set, but now the problem is I am getting the third column but with... (3 Replies)
Discussion started by: nnani
3 Replies
8. UNIX for Dummies Questions & Answers
Version: RHEL 5.8
I am doing a grep of the piped output from ps command as shown below.
I am grepping for the pattern ora_dbw* . But, in the result set I am seeing strings with ora_dbr* as well like ora_dbrm_SDLM1DAS3 as shown below. Any idea why is this happening ?
$ ps -ef | grep... (6 Replies)
Discussion started by: John K
6 Replies
9. Shell Programming and Scripting
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies
10. Shell Programming and Scripting
Hi
I am comparing two files with comm -13 < (sort acc11.txt) < (sort acc12.txt) > output.txt
purpose: Get non matching records which are in acc12 but not in acc11...
TI am getting WRONG output.
Is there any constraints with record length with comm? The above files are the two consective ... (2 Replies)
Discussion started by: vedanta
2 Replies
LEARN ABOUT DEBIAN
shtoolize
SHTOOLIZE.TMP(1) GNU Portable Shell Tool SHTOOLIZE.TMP(1)
NAME
shtoolize - Build individual GNU shtool scripts
VERSION
GNU shtool 2.0.8 (18-Jul-2008)
SYNOPSIS
shtoolize [-h] [-v] [-q] [-o script] module [ module ... ]
DESCRIPTION
The shtoolize program builds individual GNU shtool scripts (written to the default output file "shtool" or to the specified script) out of
one or more shtool ingredient modules. Available modules are:
echo Print string with optional construct expansion
mdate Pretty-print modification time of a file or dir
table Pretty print a field-separated list as a table
prop Display progress with a running propeller
move Move files with simultan substitution
install Install a program, script or datafile
mkdir Make one or more directories
mkln Make link with calculation of relative paths
mkshadow Make a shadow tree
fixperm Fix file permissions inside a source tree
rotate Rotate a logfile
tarball Roll distribution tarballs
subst Apply sed(1) substitution operations
platform Platform identification utility
arx Extended archive command
slo Separate linker options by library class
scpp Sharing C Pre-Processor
version Generate and maintain a version information file
path Deal with program paths
Additionally there is a pseudo-module ``"all"'' which can be used as a short-hand for ``"echo mdate table prop move install mkdir mkln
mkshadow fixperm platform arx slo scpp version path"'', i.e. to build a shtool script with all modules in the standard order. An installed
shtool is usually built this way via ``"shtoolize -o shtool all"''.
Use the shtoolize program to build individual shtool scripts in case you want a smaller sized script and you don't need all of the
available shtool functionality. For instance for the classical Autoconf based free software package a "shtool" script build via
``"shtoolize -o shtool install mkdir"'' might be sufficient.
OPTIONS
The following command line options exist:
-h Displays a short help page describing the usage of shtoolize.
-v Displays the version number of shtoolize/shtool.
-q Displays no processing information.
-o script
Writes the output to file script instead to file ``"shtool"''.
EXAMPLE
The typical free software package which is based on GNU libtool and GNU shtool one uses a "Makefile" entry like the following:
# Makefile entry for upgrading GNU tools
upgrade-tools:
libtoolize -f -c
shtoolize -q all
This upgrades the three files "ltmain.sh", "ltconfig" and "shtool" in the current source tree to the latest versions.
SEE ALSO
shtool(1).
AUTHOR
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
18-Jul-2008 shtool 2.0.8 SHTOOLIZE.TMP(1)