03-11-2008
awk to print ' (single quotes)
I'm building a file with sql delete statements. I need to print the single quotes for the where clause.
i.e.
delete from Command where CommandName = 'SomeName';
I have the following in my script
input=$(pwd)/Cmnd.csv
i=0
while read line
do
if test $i -ge 1;
then
echo "$line" | awk -F'|' '{print "delete from Command where CommandName='"$1"';}' >> deleteCmd.dat
fi
i=$i+1
done < $input
This gives me:
delete from Command where CommandName=;
how do I print the (single quotes) ' with awk?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have written a code to modify a string say,
StringA=abc,def,ghi
I need to change it to something like:
StringB=This means abc='ABC', This mean def='DEF', This means ghi= 'GHI'
StringB=$(echo $StringA | awk -F',' 'BEGIN { OFS="," } { for (i=1; i<=NF;i++) $i="This means... (2 Replies)
Discussion started by: tostay2003
2 Replies
2. Shell Programming and Scripting
Hi,
I am trying to write the following command as an alias in my .bashrc file.
bjobs -u all | awk '{if (NR > 1) {username++;}}END{{print"\nJOBS BY USER:\n"} for (i in username) {print username,i;}{print"\n Total Jobs=",NR-1,"\n" }}'
The command simply puts how many jobs each user is... (2 Replies)
Discussion started by: jacekmaciek
2 Replies
3. Shell Programming and Scripting
Hello. I'm trying to write a bash script that uses GNU screen and have hit a brick wall that has cost me many hours... (I'm sure it has something to do with quoting/globbing, which is why I post it here)
I can make a script that does the following just fine:
test.sh:
#!/bin/bash
# make... (2 Replies)
Discussion started by: jondecker76
2 Replies
4. Shell Programming and Scripting
How can I use single quotes as field separator in awk? (1 Reply)
Discussion started by: locoroco
1 Replies
5. UNIX for Dummies Questions & Answers
Hi i have to insert the below line into a specific line number of another file
export MBR_CNT_PRCP_TYPE_CODES_DEL="'01','02','04','05','49','55','UNK'"
I have passed the above line to a variable say ins_line. I have used below command to perform the insert
awk 'NR==3{print "'"${ins_line}"'"}1'... (1 Reply)
Discussion started by: sathishteradata
1 Replies
6. Shell Programming and Scripting
How do I use single quotes as record separator in awk?
I just couldn't figure that out. I know how to use single quotes as field separator, and double quotes as both field and record separator ... (1 Reply)
Discussion started by: locoroco
1 Replies
7. Shell Programming and Scripting
# echo 'export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk '{print \$1}')' >> new_file
#
# cat new_file
export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk {print $1})
#
Now how to echo the quotes around the... (2 Replies)
Discussion started by: proactiveaditya
2 Replies
8. Shell Programming and Scripting
Hi,
Trying to change the prompt. I have the following code.
export PS1='
<${USER}@`hostname -s`>$ '
The hostname is not displayed
<abc@`hostname -s`>$ uname -a
AIX xyz 1 6 00F736154C00
<adcwl4h@`hostname -s`>$
If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies
9. Shell Programming and Scripting
Hi All,
I have input data like follows:
"1234"|"ABC"
"1234"|"CBA"
"1222"|"ZZZ"
I am trying to awk print all records where Col1 = "1234".
Below is the code I have so far:
Var1=1
Var2=1234
awk -F "|" "$ ${Var1} == "\"${Var2}\"" { print; }' inputfile
However when the AWK... (2 Replies)
Discussion started by: RichZR
2 Replies
10. Shell Programming and Scripting
Hi,
Need help, using awk command to insert statement
awk -v q="'" '{ print "db2 connect to repolab > /dev/null; " "\n" "db2 -x \" select name from IBMPDQ.PROFILE where managed_database = " q $1"_"$3"__0" q "\"" } ' profile.txt | sh - | awk -v i="'" ' { print "db2 connect to repolab >... (1 Reply)
Discussion started by: Mathew_paul
1 Replies
LEARN ABOUT DEBIAN
net::epp::frame::command::delete::host
Net::EPP::Frame::Command::Delete::Host(3pm) User Contributed Perl Documentation Net::EPP::Frame::Command::Delete::Host(3pm)
NAME
Net::EPP::Frame::Command::Delete::Host - an instance of Net::EPP::Frame::Command::Delete for host objects.
SYNOPSIS
use Net::EPP::Frame::Command::Delete::Host;
use strict;
my $delete = Net::EPP::Frame::Command::Delete::Host->new;
$delete->setHost('example.tld');
print $delete->toString(1);
This results in an XML document like this:
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<delete>
<host:delete
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0
host-1.0.xsd">
<host:name>ns0.example.tldE<lt>/host:name>
</host:delete>
</delete>
<clTRID>0cf1b8f7e14547d26f03b7641660c641d9e79f45</clTRIDE<gt>
</command>
</epp>
OBJECT HIERARCHY
L<XML::LibXML::Node>
+----L<XML::LibXML::Document>
+----L<Net::EPP::Frame>
+----L<Net::EPP::Frame::Command>
+----L<Net::EPP::Frame::Command::Delete>
+----L<Net::EPP::Frame::Command::Delete::Host>
METHODS
$frame->setHost($host_name);
This specifies the host object to be deleted.
AUTHOR
CentralNic Ltd (http://www.centralnic.com/).
COPYRIGHT
This module is (c) 2012 CentralNic Ltd. This module is free software; you can redistribute it and/or modify it under the same terms as Perl
itself.
SEE ALSO
o Net::EPP::Frame
perl v5.14.2 2012-04-23 Net::EPP::Frame::Command::Delete::Host(3pm)