Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Replace newline with comma and append quotes Post 303034249 by Rtk on Monday 22nd of April 2019 10:02:41 PM
Old 04-22-2019
Replace newline with comma and append quotes

Hi,

I have below requirement.
Code:
Apple
Orange
Banana

Required O/p in bash
Code:
'Apple,Orange,Banana'

Can you please help.

Moderator's Comments:
Mod Comment Please wrap your samples, codes in CODE TAGS as per forum rules.

Last edited by RavinderSingh13; 04-22-2019 at 11:10 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace comma with newline

Hi, for some reason I cant seem to figure this out. I have a file which looks something like this word word word word word,word,word word word word,word,word,word,word word word Basically I want this whole thing to be a list with 1 word on each line like this... word word word... (1 Reply)
Discussion started by: eltinator
1 Replies

2. Shell Programming and Scripting

To Replace comma with Pipe inside double quotes

Hi, I have a requirement to replace the comma's inside the double quotes. The comma's inside the double quotes will get changed dynamically. Input Record: "Washington, DC,Prabhu,aju",New York Output Record: "Washington| DC|Prabhu|aju",New York I tried with the below command but it... (3 Replies)
Discussion started by: prabhutkl
3 Replies

3. Shell Programming and Scripting

Replace newline with comma.

I have output from a file like this: 15,01,11,14:06 235 I would like to change this to: 15,01,11,14:06,235 Removing newline and change to "," I now this can be done with tr cat OUT | tr '\n' ','' My problem is that tr is not implemented in this shell. sed is, show it should be... (7 Replies)
Discussion started by: Jotne
7 Replies

4. Shell Programming and Scripting

shell script - to append single quotes and comma

file1 ---- 34556745 32678343 31576776 31455566 21356666 I want to assign the record values to a variable in the below format, so that I can use output in .sql file for querying in database. ('34556745', '32678343', '31576776', '31455566', '21356666') ----------- below is the... (11 Replies)
Discussion started by: rajivrsk
11 Replies

5. Shell Programming and Scripting

Replace newline character between a double quotes to a space

Hi Guys, I have a file with content as below aj.txt "Iam allfine" abcdef abcd "all is not well" What I'm trying to say is my data has some new line characters in between quoted text. I must get ride of the newline character that comes in between the quoted text. output must be:... (8 Replies)
Discussion started by: ajahuja
8 Replies

6. Shell Programming and Scripting

Replace comma delimiter by newline

The input file is as below AR,age,marks,roll,section,evin,25,80,456,A,atch,23,56,789,B,eena,24 ,78H245,C,Ps,ot,ecessary,hat,ame comes first then age and rest AR AZ,kevin,25,80,456,A,Satch,23,56,789,Satch,23,56,789,B,Meena,24,78,H245,C,AZ ................ ................ I am writting... (8 Replies)
Discussion started by: millan
8 Replies

7. Shell Programming and Scripting

How to replace NewLine with comma using sed?

Hi , I have a huge file with following records and I want to replace the last comma with ',NULL'. I try using SED but could not create a correct script . In my opinion I need a script which can convert ,/n with ,NULL/n 1,CHANGE_MEMBER,2010-12-28 00:05:00, 2,CHANGE_MEMBER,2012-09-02... (8 Replies)
Discussion started by: Ajaypal
8 Replies

8. Shell Programming and Scripting

Command to replace newline with comma

Hi Experts, I need an urgent help in replacing newline characters in my single column file by a comma. I am using following command for this purpose: sed -n -e 'H;${x;s/\n/,/g;s/^,//;p;}' parameter.rtf | rev | cut -c 4- | revMy input file has: TABLE_1 TABLE_2 TABLE_3 What I need:... (11 Replies)
Discussion started by: neerndg123
11 Replies

9. Programming

Replace comma which is not inside brackets,quotes or paranthesis

Hi All, I want to replace the commas which are not inside parenthesis,quotes if input is abc,,lm,(no,pq,rs),{tu,vw,xy},zs,"as,as,fr",'ab,cd,ef' output should be abc lm (no,pq,rs) {tu,vw,xy} zs "as,as,fr" 'ab,cd,ef' I tried this str.replaceAll("\\(.*?\\)|(,)", " "); say my string... (3 Replies)
Discussion started by: preethy
3 Replies

10. Shell Programming and Scripting

awk to parse comma separated field and removing comma in between number and double quotes

Hi Experts, Please support I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6. ... (3 Replies)
Discussion started by: as7951
3 Replies
ipsec_config(1M)														  ipsec_config(1M)

NAME
ipsec_config - add, delete, export, and show HP-UX IPSec configuration objects in the HP-UX IPSec configuration database SYNOPSIS
[operation [object_type]] DESCRIPTION
The command adds, deletes, exports, and shows HP-UX IPSec configuration objects in the HP-UX IPSec configuration database, If HP-UX IPSec is active and running, also updates the HP-UX runtime IPSec policy database and runtime IKE information (IKE policies and authentication records). You must be superuser to run The utility can operate in command-line mode or batch mode. In command-line mode, reads all input from the command line. In batch mode, reads add and delete operations from a file. Batch mode allows administrators to add and delete multiple configuration objects in one operation. HP-UX IPSec processes the operations in a batch file as a group. Batch mode is useful if you are adding or deleting configura- tion records that may affect other records. HP recommends that you use a batch file to add configuration information. A batch file provides a permanent record of the configuration data and can be used to re-create the configuration database. Separate command arguments using whitespace (blanks, tabs or newlines). Use a backslash line continuation character to continue command input on subsequent lines. Operations and Object Types The command supports the following operations: See ipsec_config_add(1M) for more information. See ipsec_config_batch(1M) for more information. See ipsec_config_delete(1M) for more information. See ipsec_config_export(1M) for more information. See ipsec_config_show(1M) for more information. object_type can be one of the following: Authentication records, which specify Internet Key Exchange (IKE) versions, authentication methods, identity information and preshared keys. Bypass addresses. security certificate for a Certificate Authority (used for IKE authentication with RSA signatures). Certificate Revocation List (CRL). A CRL contains a list of revoked X.509 security certificates. If you have a CRL, HP-UX IPSec check it during the IKE authentication process to verify that the remote system's security certificate is valid (not revoked). Certificate Signing Request (CSR), which the HP-UX IPSec administrator can submit to a Certificate Authority (CA) to request a signed X.509 security certificate. Host IPsec policies, which specify HP-UX IPSec behavior for processing IP packets when the local system is an end host. IKE version 1 (IKEv1) policies. IKE version 2 (IKEv2) policies. security certificate for the local system (used for IKE authentication with RSA signatures). Start-up options. Tunnel IPsec policies, which specify IPsec tunnel transform parameters. Configuring Objects In most HP-UX IPSec topologies, you must configure the following objects: o Host IPsec policies o Authentication records (IKE ID information and preshared keys) To establish IPsec security, you must also have an IKE version 1 (IKEv1) or IKE version 2 (IKEv2) policy. The HP-UX IPSec product installs a default IKEv1 policy and a default IKEv2 policy. You can use these default policies without modifications in many topologies. HP recommends that you use the following procedure to configure HP-UX IPSec: 1. Create a batch file to configure IPsec policies and authentication records. An IKEv1 or IKEv2 policy is also required, but in most cases you can use the default IKEv1 or IKEv2 installed with the product. If you want to configure host-to-host IPsec poli- cies and use IKE with preshared keys for IKE authentication, create a batch file to contain the following statements: See the command subsection in ipsec_config_add(1M) for syntax and usage information. If you are using HP-UX IPSec with certificates (RSA signatures) for IKE authentication, you must also use the following com- mands to configure certificates: You must enter the above commands at the command-line prompt. (You cannot specify them in an batch file). The command creates a certificate signing request (CSR). As an alternative, you can use a utility provided by the certificate vendor to create the CSR. 2. Test the syntax of your batch file by entering the following command: The option verifies the syntax without adding objects to the database. 3. If the syntax is correct, add the configuration information to the configuration database by entering the following command: 4. Start and verify HP-UX IPSec. Use the following command to start HP-UX IPSec: Generate network traffic that uses IPsec. Use the following command to verify operation: Verify that HP-UX IPSec has created Security Associations (SAs) with the appropriate systems. 5. Use the command to configure HP-UX IPSec to automatically start at system boot-up time. ipsec_config Help The displays help and usage information for the HP-UX IPSec operations. Use the following syntax to access help: [operation [option_type]] EXAMPLES
You have two systems, Apple and Banana Apple and Banana are not multihomed. You want to secure all telnet packets between the two systems using IPsec ESP with AES, authenticated with SHA-1. The IKE version is IKEv1. This is a private network, and you will allow all other packets to pass in clear text. You use the default IKEv1 policy. On Apple, you configure: o Two host IPsec policies o One authentication record The first host IPsec policy, telnetAB, secures outbound telnet connections (Apple is the telnet client). You do not need to specify the source argument, since it will default to any IP address and any port, and the telnet client port number is dynamically allocated. The second policy, telnetBA, secures inbound telnet connections (Apple is the telnet server). The authentication record specifies the preshared key value used with (Banana): The configuration on Banana is the mirror image of the configuration on Apple: AUTHOR
was developed by HP. FILES
configuration database. default profile file. SEE ALSO
ipsec_admin(1M), ipsec_config_add(1M), ipsec_config_batch(1M), ipsec_config_delete(1M), ipsec_config_export(1M), ipsec_config_show(1M), ipsec_migrate(1M), ipsec_policy(1M), ipsec_report(1M). HP-UX IPSec Software Required ipsec_config(1M)
All times are GMT -4. The time now is 05:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy