12-01-2008
Issue with a sed one liner variant - sed 's/ ; /|/g' $TMP1 > $TMP
Execution of the following segment is giving the error -
Script extract:-
OUT=$DATADIR/sol_rsult_orphn.bcp
TMP1=${OUT}_tmp1
TMP=${OUT}_tmp
( isql -w 400 $dbConnect_OPR <<EOF
select convert(char(10), s.lead_id)
+'|'
+ s.pho_loc_type,
";",
s.sol_rsult_cmnt,
";",
+'|'+ s.del_ind
from sol_rsult s
where not exists (select 1 from lead_addl_info a
where a.lead_unique_num = s.lead_unique_num )
and s.emp_id >= 0
go
EOF
) >$TMP1
echo "\n`date +%X` Create a bcp in file having Orphan records starts:"
sed 's/ ; /|/g' $TMP1 > $TMP
Script output:-
19:44:58 Create a bcp in file having Orphan records starts:
=== ERROR generating the file === rc=3.
Please assist.
Error seems to be due to the sytax of the sed command used:-
sed 's/ ; /|/g' $TMP1 > $TMP
Also note that reason for using leading and trailing space for ; is because the output of the sql query gives a space before and after ; in the file.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi group,
I want to replace the occurance of a particular text in a paragraph.I tried with Sed,but Sed only displays the result on the screen.How can i update the changes in the original file???
The solution should be a one liner using awk and sed.
Thanks in advance. (5 Replies)
Discussion started by: bishnu.bhatta
5 Replies
2. Shell Programming and Scripting
I need to print specific lines from a file, say 2-5, 8, 12-15, 17, 19, 21-27. How do I achieve this? (2 Replies)
Discussion started by: Ilja
2 Replies
3. Shell Programming and Scripting
I want to use SED to replace all new line characters of a file, I googled and found this one liner
sed '{:q;N;s/\n//g;t q}' infile
what do :q;N; and t q mean in this script? (6 Replies)
Discussion started by: kevintse
6 Replies
4. Shell Programming and Scripting
sed awk one liner (2 Replies)
Discussion started by: jap2614
2 Replies
5. Shell Programming and Scripting
hey everyone,
I want to remove some characters from a string that i have with sed. For example if my string is:
a0=bus a1=car a2=truck
I want my output to look like this:
bus car truck
So i want to delete the two characters before the = and including the =. This is what i came up with... (3 Replies)
Discussion started by: GmGeubt
3 Replies
6. UNIX for Advanced & Expert Users
Can anyone explain the below sed oneliner?
sed -e ':a' -e '$q;N;11,$D;ba'
It works same as tail command.
I just want to know how it works.
Thanks
---------- Post updated at 11:42 PM ---------- Previous update was at 11:37 PM ----------
Moderators,
Can you please delete this thread?... (0 Replies)
Discussion started by: pandeesh
0 Replies
7. UNIX for Advanced & Expert Users
Can anyone explain the below sed oneliner?
sed -e ':a' -e '$q;N;11,$D;ba'
It works same as tail command.
I just want to know how it works.
Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies
8. UNIX for Dummies Questions & Answers
I have a data base of part numbers:
AAA Thing1
BBB Thing2
CCC Thing3
File one is a list of part numbers:
AAA234
BBB678
CCC2345
Is there a sed one-line that would compare a data base with and replace the part numbers so that the output looks like this?
AAA234 Thing1
BBB678 Thing2... (5 Replies)
Discussion started by: jimmyf
5 Replies
9. UNIX for Dummies Questions & Answers
I have a data base of part numbers:
AAA Thing1
BBB Thing2
CCC Thing3
File one is a list of part numbers:
XXXX AAA234
XXXX BBB678
XXXX CCC2345
Is there a sed one-line that would compare a data base with and replace the part numbers so that the output looks like this?
XXXX AAA234... (7 Replies)
Discussion started by: jimmyf
7 Replies
10. Shell Programming and Scripting
Hi,
I have the following command.(Delete all trailing blank lines at the end of a file.)
sed -e :a -e '/^\n*$/{$d;N;ba' -e '}'
I don't understand the logic of this command and also I don't understand why -e is used.
Can you please let me know the logic of this command and why three -e... (5 Replies)
Discussion started by: TomG
5 Replies
BCP(1) Boost C++ Libraries Documentation BCP(1)
NAME
bcp - extract subsets of Boost
SYNOPSIS
bcp --list [options] module-list
bcp [options] module-list output-path
bcp --report [options] module-list html-file
bcp --help
DESCRIPTION
Copies all the files, including dependencies, found in module-list to output-path. output-path must be an existing path.
With --list, prints the list of all the files in module-list, including dependencies.
With --report, writes the HTML report to html-file.
With --help, prints a quick usage reminder.
It is useful for Boost authors who want to distribute their library separately from Boost and for Boost users who want to distribute a sub-
set of Boost with their application.
module-list
When the --scan option is not used, a list of Boost files or library names to copy. It can be:
- The name of a tool: for example "build" will find "tools/build".
- The name of a library: for example "regex".
- The title of a header: for example "scoped_ptr" will find "boost/scoped_ptr.hpp".
- The name of a header: for example "scoped_ptr.hpp" will find "boost/scoped_ptr.hpp".
- The name of a file: for example "boost/regex.hpp".
When the --scan option is used, a list of (probably non-boost) files to scan for Boost dependencies, the files in the module list are not
therefore copied/listed.
File dependencies
C++ source files are scanned for #includes, all #includes present in the Boost source tree will then be scanned for their dependencies and
so on.
C++ source files are associated with the name of a library, if that library has source code (and possibly build data), then include that
source in the dependencies.
C++ source files are checked for dependencies on Boost.Test (for example to see if they use cpp_main as an entry point).
HTML files are scanned for immediate dependencies (images and style sheets, but not links).
HTML report contains:
- all the licenses in effect, plus the files using each license, and the copyright holders using each license
- any files with no recognizable license (please report these to the Boost mailing lists)
- any files with no recognizable copyright holders (please report these to the Boost mailing lists)
- all the copyright holders and the files on which they hold copyright
- file dependency information - indicates the reason for the inclusion of any particular file in the dependencies found
OPTIONS
--boost=path
sets the location of the Boost tree to path
--scan treat the module list as a list of (possibly non-boost) files to scan for Boost dependencies
--cvs only copy files under CVS version control
--unix-lines
make sure that all copied files use Unix style line endings
EXAMPLES
bcp scoped_ptr /foo
Copies boost/scoped_ptr.hpp and dependencies to /foo.
bcp boost/regex.hpp /foo
Copies boost/regex.hpp and all dependencies including the regex source code (in libs/regex/src) and build files (in
libs/regex/build) to /foo. Does not copy the regex documentation, test or example code.
bcp regex /foo
Copies the full regex lib (in libs/regex) including dependencies (such as the Boost.Test source required by the regex test programs)
to /foo.
bcp regex config build /foo
Copies the full regex lib (in libs/regex) plus the config lib (libs/config) and the build system (tools/build) to /foo including all
the dependencies.
bcp --scan --boost=/boost foo.cpp bar.cpp boost
Scans the [non-boost] files foo.cpp and bar.cpp for Boost dependencies and copies those dependencies to the sub-directory boost.
bcp --report regex.hpp boost-regex-report.html
Creates a HTML report called boost-regex-report.html for the Boost module regex.hpp.
AUTHORS
Author of bcp is John Maddock.
Author of this manpage is Domenico Andreoli, who copied stuff from bcp --help and the HTML documentation.
Boost C++ Libraries March 2006 BCP(1)