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
Prophet::Test(3pm)					User Contributed Perl Documentation					Prophet::Test(3pm)

   set_editor($code)
       Sets the subroutine that Prophet should use instead of "Prophet::CLI::Command::edit_text" (as this routine invokes an interactive editor)
       to $code.

   set_editor_script SCRIPT
       Sets the editor that Proc::InvokeEditor uses.

       This should be a non-interactive script found in t/scripts.

   import_extra($class, $args)
   in_gladiator($code)
       Run the given code using Devel::Gladiator.

   repo_path_for($username)
       Returns a path on disk for where $username's replica is stored.

   repo_uri_for($username)
       Returns a file:// URI for $USERNAME'S replica (with the correct replica type prefix).

   replica_uuid
       Returns the UUID of the test replica.

   database_uuid
       Returns the UUID of the test database.

   replica_last_rev
       Returns the sequence number of the last change in the test replica.

   as_user($username, $coderef)
       Run this code block as $username.  This routine sets up the %ENV hash so that when we go looking for a repository, we get the user's repo.

   replica_uuid_for($username)
       Returns the UUID of the given user's test replica.

   database_uuid_for($username)
       Returns the UUID of the given user's test database.

   ok_added_revisions( { CODE }, $numbers_of_new_revisions, $msg)
       Checks that the given code block adds the given number of changes to the test replica. $msg is optional and will be printed with the test
       if given.

   serialize_conflict($conflict_obj)
       Returns a simple, serialized version of a Prophet::Conflict object suitable for comparison in tests.

       The serialized version is a hash reference containing the following keys:
	   meta => { original_source_uuid => 'source_replica_uuid' }
	   records => { 'record_uuid' =>
			  { change_type => 'type',
			    props => { propchange_name => { source_old => 'old_val',
							    source_new => 'new_val',
							    target_old => 'target_val',
							  }
				     }
			  },
			'another_record_uuid' =>
			  { change_type => 'type',
			    props => { propchange_name => { source_old => 'old_val',
							    source_new => 'new_val',
							    target_old => 'target_val',
							  }
				     }
			  },
		      }

   serialize_changeset($changeset_obj)
       Returns a simple, serialized version of a Prophet::ChangeSet object suitable for comparison in tests (a hash).

   run_command($command, @args)
       Run the given command with (optionally) the given args using a new Prophet::CLI object. Returns the standard output of that command in
       scalar form or, in array context, the STDOUT in scalar form *and* the STDERR in scalar form.

       Examples:

	   run_command('create', '--type=Foo');

   load_record($type, $uuid)
       Loads and returns a record object for the record with the given type and uuid.

   as_alice CODE, as_bob CODE, as_charlie CODE, as_david CODE
       Runs CODE as alice, bob, charlie or david.

perl v5.10.1							    2009-09-02							Prophet::Test(3pm)
All times are GMT -4. The time now is 05:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy