03-29-2006
just an example use it according to ur needs
awk -v q="'" '{print q $0 q}' filename
will enclose each line in file with single quote
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
I am passing a variable site_name from a shellscript to an SQL script and then I want to spool an sql query on to my Unix box and generate a CSV file.
Everything works fine but I have to give quotes to the variable '&&site_name' in spool statement ..if i remove the quotes it generates an LST... (6 Replies)
Discussion started by: phani
6 Replies
2. Programming
Hi !
Can anyone please tell me how can I check if a character is single quotes in C ?
Thanks,
Jane A (3 Replies)
Discussion started by: janemary.a
3 Replies
3. Shell Programming and Scripting
Hi,
Please help me to echo the following statement using single quotes
Why can't I write 's between single quotes
Thanks in advance,
Chella (3 Replies)
Discussion started by: chella
3 Replies
4. Shell Programming and Scripting
I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example,
$ ITSME=itsme
$ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME"
itsme
$ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME'
itsyou
$... (3 Replies)
Discussion started by: password636
3 Replies
5. Shell Programming and Scripting
Hi guys, I have a sed line in double quotes which works fine, but I want it to be in single quotes
here is the sed line
sed "/abc_def/s/\'.*\'/\'\${abc_def}\'/"
can some one give the equivalent to the above script in single quotes
Thanks a ton (5 Replies)
Discussion started by: sol_nov
5 Replies
6. UNIX for Dummies Questions & Answers
Unix superusers,
I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
Discussion started by: george_vandelet
2 Replies
7. Shell Programming and Scripting
Hi I want to replace single quote with two single quotes in a perl string.
If the string is <It's Simpson's book> It should become <It''s Simpson''s book> (3 Replies)
Discussion started by: DushyantG
3 Replies
8. 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
9. 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
10. Shell Programming and Scripting
Hi,
I have a grep command which searches if a particular word ends in a pattern
grep 'ee\>' *
The above command searches for any word that ends with ee across files and works as expected.
I need to parametrize ee and run the command
so I tried the following but none work
A=ee
grep... (1 Reply)
Discussion started by: wahi80
1 Replies
GREP(1) General Commands Manual GREP(1)
NAME
grep - search a file for a pattern
SYNOPSIS
grep [ option ... ] pattern [ file ... ]
DESCRIPTION
Grep searches the input files (standard input default) for lines (with newlines excluded) that match the pattern, a regular expression as
defined in regexp(6). Normally, each line matching the pattern is `selected', and each selected line is copied to the standard output.
The options are
-c Print only a count of matching lines.
-h Do not print file name tags (headers) with output lines.
-i Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpre-
tation. Matched lines are printed in their original form.
-l (ell) Print the names of files with selected lines; don't print the lines.
-L Print the names of files with no selected lines; the converse of -l.
-n Mark each printed line with its line number counted in its file.
-s Produce no output, but return status.
-v Reverse: print lines that do not match the pattern.
Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name
argument.)
Care should be taken when using the shell metacharacters $*[^|()= and newline in pattern; it is safest to enclose the entire expression in
single quotes '...'.
SOURCE
/sys/src/cmd/grep.c
SEE ALSO
ed(1), awk(1), sed(1), sam(1), regexp(6)
DIAGNOSTICS
Exit status is null if any lines are selected, or non-null when no lines are selected or an error occurs.
GREP(1)