Sponsored Content
Top Forums Shell Programming and Scripting Inserting semicolon at the end of a line Post 302836305 by Priya Amaresh on Wednesday 24th of July 2013 02:31:55 AM
Old 07-24-2013
Inserting semicolon at the end of a line

HI

Am totally confused with sed and translate command command.. My problem is

I have a file like
Code:
# vi test.csv
ABC_IMUY
ERD0_FN
VEG_NON_DES_IYT
BUY4_FLOW
POI_SHD_URDF_IYUT_REDS_CYC
UYT_PMC4_WIND
EX_FRE_FRD_L2_REF_FLICT
JHY_SGT_DSE_L2
IYO_HYTR_FGT_L3_BGT_ICT
CICO_MCX_MCOIE_L3.1_DSA
VGRE_BUWTE_YIURE_RL2L3_SHR
VT_TYEW_UEV_LL4
KODK_IWJXMX_MXEWI_L2ISS_BYW
MOSW_NAS_NIRS_L2_OIY_DSE

I used translate command as
tr '\n' ';' test1.csv > test1.csv_1

I got the output as
Code:
ABC_IMUY;ERD0_FN;


But I need the output as

Code:
# vi test.csv
ABC_IMUY;
ERD0_FN;
VEG_NON_DES_IYT;
BUY4_FLOW;
POI_SHD_URDF_IYUT_REDS_CYC;
UYT_PMC4_WIND;
EX_FRE_FRD_L2_REF_FLICT;
JHY_SGT_DSE_L2;
IYO_HYTR_FGT_L3_BGT_ICT;
CICO_MCX_MCOIE_L3.1_DSA;
VGRE_BUWTE_YIURE_RL2L3_SHR;
VT_TYEW_UEV_LL4;
KODK_IWJXMX_MXEWI_L2ISS_BYW;
MOSW_NAS_NIRS_L2_OIY_DSE;

Please help..Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

put a semicolon at the end of each line of a file

hi, Consider there is a file containing 200 lines. please let me know which command is to be used to put a semicolon at the end of each line. if no single command is there then how it can be achieved. (1 Reply)
Discussion started by: surjyap
1 Replies

2. Shell Programming and Scripting

Inserting a line at the end

Hi All, I am using the below script to enter the URL at the end of file: echo "Enter the URL that should point to the particular microsite" read url sed "$a $url" redirects.virgin-atlantic.com.conf > temp But am getting the below error: ./script.sh:... (7 Replies)
Discussion started by: Shazin
7 Replies

3. UNIX for Dummies Questions & Answers

Inserting control characters at the end of each line

How to add control characters at the end of each line in a file? Can anyone help me with this? Thanks, Shobana (2 Replies)
Discussion started by: Shobana_s
2 Replies

4. UNIX for Dummies Questions & Answers

Inserting a ' at the end of each line

Hi all, I can use the following command to insert a ' at the beginning of each line sed "s/^/'/g" test.txt > test1.txt However, I'm unable to use the following to insert a ' at the end of each line in this way sed "s/$/'/g" test.txt > test1.txt Any... (3 Replies)
Discussion started by: karthiknaidu
3 Replies

5. Shell Programming and Scripting

Replace a string after n semicolon every line

I have a file that is formatted in this way. a1;b2;c33;d4;e5;e;f;f;f;s d;ds;d;a;v;b;g;gr;r;rt;fdf s1;s2;s2;s3;s4; b1;f2;g3;h4;a3c4e;xcsd;fds; sd2;fs4;fs2;sdf3; I want to replace the value just before the 4th semicolon to empty string, regardless the value, such that it looks... (3 Replies)
Discussion started by: alienated
3 Replies

6. UNIX for Dummies Questions & Answers

How move characters following a semicolon to a new line

Hello, I was wondering how I can move this: ABC;>12 BLA;>67 DEF;>22 into this ABC >12 BLA >67 DEF >22 thanks for your help. (1 Reply)
Discussion started by: blakers
1 Replies

7. Shell Programming and Scripting

Adding semicolon at the end of each line

Hi, I have a script which I need to change. I want to add a semicolon at the end of each line where the line starts with "grant" for e.g. create table(.... ); grant select on TABL1 to USER1 grant select on TABL1 to USER2should become create table(.... ); grant select on TABL1 to... (3 Replies)
Discussion started by: pparthiv
3 Replies

8. Shell Programming and Scripting

How to have semicolon at the end of every line?

Hi, I wanted to create an automated script that will output a create table statement in unix. Below is the input and the desired output: INPUT: desc ZZ_APL_TIDDATELIST ( TID NUMBER AEX_DATE TIMESTAMP(6) ) desc ZZ_APL_TIDLIST ( TID NUMBER ) desc... (5 Replies)
Discussion started by: reignangel2003
5 Replies

9. Shell Programming and Scripting

Replace semicolon within double quotes in a file with semicolon delimiter

Hello Team, Could you please help me with the below question? I have a file with the following properties 1) File Delimiter is ; 2) Text columns are within double quotes 3) Numeric columns will not have double quotes 4) File has total 6 columns Please see a sample record from file ... (3 Replies)
Discussion started by: sam99
3 Replies

10. UNIX for Beginners Questions & Answers

Inserting a blank line at the end of a .txt file?

Hi there, I am having this problem: a) I am uploading a txt file from windows (notepad) with some Gaussian 09 command lines; b) Gaussian needs in certain command files, that those files have a blank line at the end of the file! c) I open the command file with vi and no blank line at the of... (2 Replies)
Discussion started by: luismga
2 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 05:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy