Visit Our UNIX and Linux User Community

how to make ABC into "ABC" ina file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to make ABC into "ABC" ina file
# 1  
Old 10-06-2007
Bug how to make ABC into "ABC" ina file

suppose u have a file

so output shud be like
# 2  
Old 10-06-2007
while read N
   for d in N
       echo \"$d\"
done <file

# 3  
Old 10-06-2007
sed 's/[^ ]*/"&"/g' filename

# 4  
Old 10-06-2007
echo "ABC CDF ADF FDG HAA AHH AHA" | awk '{ for ( i=1; i<=NF; i++ ) { printf "\"%s\" ", $i } }END{ printf "\n" }'

# 5  
Old 10-06-2007
as simple as this...using sed..

sed 's/[a-zA-Z]*/"&"/g' filename

Devaraj Takhellambam
# 6  
Old 10-08-2007

Hi, try this one.

echo ABC CDF ADF FDG HAA AHH AHA | sed 's/\([a-zA-Z]\{3\}\)/\"&\"/g'

# 7  
Old 10-09-2007
same thing i wanted to try using file
but it is not working

Previous Thread | Next Thread
Test Your Knowledge in Computers #945
Difficulty: Medium
A Fraggle attack is a variation of the Smurf attack where an attacker sends a large amount of UDP traffic to ports 7 (Echo) and 19 (CHARGEN) to an IP broadcast address with the intended victim's spoofed source IP address.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Echo "abc" | sed - r 's/a/&_&/

I want to know the working of & here step by step using sed command. (1 Reply)
Discussion started by: Preeti07
1 Replies

2. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

3. Shell Programming and Scripting

Make scipt except from "Y","y" and "yes" to take [Enter] as being "yes"

This is the script: #!/bin/sh if ; then rm -rf /usr/share/WallpaperChanger; fi if ; then rm -rf /usr/bin/wallch; fi; if ; then rm -rf /usr/share/applications/wallch.desktop; fi if ; then rm -rf /usr/share/doc/wallch; fi if ; then rm -rf /usr/share/man/man1/wallch.1.gz; fi echo "Delete... (4 Replies)
Discussion started by: hakermania
4 Replies

4. Shell Programming and Scripting

del the line before the "abc"line and after it

$file1 haha hello i'm lei i'm abc you are right yes it is I want to get file2 haha i'm abc yes it is del line before and after the line contains abc I want to know the two steps 1,del the line before line "abc' ,2 del the line after the "abc question 2 (4 Replies)
Discussion started by: yanglei_fage
4 Replies

5. Shell Programming and Scripting

How can I use if statement to check a string start with "abc"

I am trying to write a if statement in KSH that if a string is start with abc then print something, I have written some code as below but it doesn't work. Could someone please help me if ] then print success fi (5 Replies)
Discussion started by: yhever
5 Replies

6. Shell Programming and Scripting

What is difference between ./ and .

Hi Friends I have one shell script If I run it ./ and . , then what is the difference.. Thanks Joy:confused: (1 Reply)
Discussion started by: itsjoy2u
1 Replies

7. Shell Programming and Scripting

In ksh shell command - Print "-ABC" is giving error

Hi Guys, while executing the following command : print "-ABC" is giving following error : ksh: print: bad option(s) I cannot use echo for some other reasons, so any other option ? (2 Replies)
Discussion started by: sagarjani
2 Replies

8. Linux

Regular expression to extract "y" from "abc/x.y.z" .... i need regular expression

Regular expression to extract "y" from "abc/x.y.z" (2 Replies)
Discussion started by: rag84dec
2 Replies

9. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

10. Shell Programming and Scripting

How to get the output from [ -s "abc.txt" ]

Hi, I am trying to check the file not empty, if its not empty then i try to send other system by ftp, the following codes doesnt work if ] then echo "File ${OUTBOUNDFILE} have data" ftp -i -n -v >> ${FTP_LOGFILE} << EOF user abc def ascii put ${OUTBOUNDFILE} quit EOF... (1 Reply)
Discussion started by: Imran_Chennai
1 Replies

Featured Tech Videos