Read a string and add " at multiple places


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read a string and add " at multiple places
# 1  
Old 08-09-2016
Read a string and add " at multiple places

Hi All,
I have below text, i want to add " in it, please advise.

Code:
FORD MOTOR COMPANY FORD COMPONENT SALES, LLC Mazda Motor Manufacturing de Mexico, S.A. de C.V.

Desired:

Code:
"FORD MOTOR COMPANY" "FORD COMPONENT SALES, LLC"" Mazda Motor Manufacturing de Mexico, S.A. de C.V."

Moderator's Comments:
Mod Comment edit by bakunin: Please use CODE-tags also for file content and terminal output. It is easier to read that way. Thank you.

Last edited by bakunin; 08-09-2016 at 12:05 PM..
# 2  
Old 08-09-2016
To answer this question one has to know where you want to put the double quotes, no? Is there any system behind where you placed them?

bakunin
# 3  
Old 08-12-2016
Welcome Amit Saroha,

I have a few to questions pose in response first:-
  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.


We're all here to learn and getting the relevant information will help us all.


Kind regards,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

2. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

3. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

4. 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

5. Shell Programming and Scripting

Using the "Less Than" (-lt) switch on numbers with decimal places?

I'm using shell scripts to run some commands for the Configuration Management tool called Telelogic Synergy. I need to get the script to compare version numbers of files. The version numbers of the files are part of the actual filename, such as the following example: example_file-1... (7 Replies)
Discussion started by: Glyn_Mo
7 Replies

6. Shell Programming and Scripting

defining a variable using multiple "entries/columns" within a line using read

Hello All, I am trying to figure out how to use the read command. I have a txt file that has rows looking something like this: 1 2 3 4 5 6 7 8 9 where each number represents an entry of various characters deliminated by tabs. My goal is to set entries 2-7 as a variable/string that I... (3 Replies)
Discussion started by: Torinator
3 Replies

7. Shell Programming and Scripting

input string="3MMTQSZ348GGMZRQWMJM4SD6M";output string="3MMTQ-SZ348-GGMZR-QWMJM-4SD6

input string="3MMTQSZ348GGMZRQWMJM4SD6M" output string="3MMTQ-SZ348-GGMZR-QWMJM-4SD6M" using linux shell script (4 Replies)
Discussion started by: pankajd
4 Replies

8. Shell Programming and Scripting

read -p "prompt text" foo say "read: bad option(s)" in Bourne-Shell

Hallo, i need a Prompting read in my script: read -p "Enter your command: " command But i always get this Error: -p: is not an identifier When I run these in c-shell i get this error /usr/bin/read: read: bad option(s) How can I use a Prompt in the read command? (9 Replies)
Discussion started by: wiseguy
9 Replies

9. Shell Programming and Scripting

retrieved multiple lines on multiple places in a file

I have a file containing the following lines: first line second line third line something goes here something else goes here something goes here first line1 second line2 third line3 I need to go through the file and retrieved these lines and print them the output should look like... (8 Replies)
Discussion started by: dala
8 Replies

10. Shell Programming and Scripting

Awk - to test multiple files "read" permission ?

Hi Masters, Iam new to this Forum and this is my first post. My question is: I've some datafiles belongs the type (A, B, C) in the location 'export/home/lokiman ' dataA1.txt dataB28.txt dataC35.txt 1) I've to check the read permission for each file, if it not there then I've to... (1 Reply)
Discussion started by: lokiman
1 Replies
Login or Register to Ask a Question