Sponsored Content
Top Forums Shell Programming and Scripting Append this string to end of each line Post 302817631 by pamu on Thursday 6th of June 2013 07:37:36 AM
Old 06-06-2013
with awk..

Code:
awk '{$0=$0" is a great language"}1' languages.txt

This User Gave Thanks to pamu For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

HOWTO Append String to End of Line

I have a comma delimited text file and need to appened ",000000" to the end of every line. For example: Before: "D700000","2006" ,"5000","Open Year" ,"Conversion" ,"Wk64","Productive Payroll $" ,1103.45 After: "D700000","2006" ,"5000","Open Year" ,"Conversion" ,"Wk64","Productive Payroll... (3 Replies)
Discussion started by: bggibson
3 Replies

2. Shell Programming and Scripting

How can I append a string at the end of a line in a file

Hi, guys. I have one question: I have a file called "group", the contents of it is below: ******************************** ... test:x:203: sales:x:204: repair:x:205: research:x:206:brownj ... *********** Now I want to add string ",sherrys" at the end of "research:x:206:brownj", so... (5 Replies)
Discussion started by: daikeyang
5 Replies

3. Shell Programming and Scripting

How do I append a ^M to the end of each 129 character string

Hello all, I have a stumper of a problem. I am trying to append a ^M or "newline" to the end of each 129 character string in a huge file in unix. Each string starts with A00. I am trying to get the file to go from... A00vswjdv1 Test Junk Junk A00vswjdv2 Test Junk Junk ... (6 Replies)
Discussion started by: Captain
6 Replies

4. Shell Programming and Scripting

Append a string at the end of every line in a file

Hi Friends, I have a file with many lines as shown below. /START SAMPLE LINE/ M:\mmarimut_v6.4.0_pit_01\java\build.xml@@\main\v6.4.0_pit_a M:\mmarimut_v6.4.0_pit_01\port\Post.java@@\main\v6.4.0_pit_a M:\mmarimut_v6.4.0_pit_01\switchview\View.java@@\main\v6.4.0_pit_a /END SAMPLE LINE/ I... (1 Reply)
Discussion started by: nmattam
1 Replies

5. Shell Programming and Scripting

Append the end of each line in a file with a given string

Hi friends, I have a file containing many lines as follows. M:\mmarimut_v6.4.0_pit_01\java\build.xml@@\main\v6.4.0_pit_a M:\mmarimut_v6.4.0_pit_01\ADBasicView.java@@\main\v6.4.0_pit_a I would like to append the string "\0" at the end of each line in the file. The output should look... (10 Replies)
Discussion started by: nmattam
10 Replies

6. Shell Programming and Scripting

Append char to the end of string from Nth column

I'm sure this is easy to do but I can't find a one line command with awk or sed to append a char to the end of the string from Nth column. Any sugestion please? Thanks (2 Replies)
Discussion started by: cabrao
2 Replies

7. Shell Programming and Scripting

find a certain line and append text to the end of the line

After I create printer queues in AIX, I have to append a filter file location within that printers custom file. within lets say test_queue.txt I need to find the row that starts with :699 and then I need to append on the end the string /usr/local/bin/k_portrait.sh. Now I've gotten the sed... (2 Replies)
Discussion started by: peachclift
2 Replies

8. Shell Programming and Scripting

Search for a string, then append character to end of that line only

I have 2 files that I am working with $ cat file1 server1 server3 server5 server6 server8 $ cat file2 server1;Solaris; server2; SLES; server3;Linux; server4; Solaris; server5;SLES; server6;SLES; server7;Solaris; server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies

9. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

10. UNIX for Advanced & Expert Users

Help in adding a string at the end of each line and append files vertically

hi, i need a help in the script , need to append a string at the end of each line of a files , and append the files into a single file vertically. eg file1 has the following columns abc,def,aaa aaa,aa,aaa files 2 has the following rows and columns abc,def,aaa aaa,aa,aaa i... (3 Replies)
Discussion started by: senkerth
3 Replies
Preferred(3pm)						User Contributed Perl Documentation					    Preferred(3pm)

NAME
Lingua::Preferred - Perl extension to choose a language SYNOPSIS
use Lingua::Preferred qw(which_lang acceptable_lang); my @wanted = qw(en de fr it de_CH); my @available = qw(fr it de); my $which = which_lang(@wanted, @available); print "language $which is the best of those available "; foreach (qw(en_US fr nl de_DE)) { print "language $_ is acceptable " if acceptable_lang(@wanted, $_); } DESCRIPTION
Often human-readable information is available in more than one language. Which should you use? This module provides a way for the user to specify possible languages in order of preference, and then to pick the best language of those available. Different 'dialects' given by the 'territory' part of the language specifier (such as en, en_GB, and en_US) are also supported. The routine "which_lang()" picks the best language from a list of alternatives. The arguments are: o a reference to a list of preferred languages (first is best). Here, a language is a string like 'en' or 'fr_CA'. ('fr_*' can also be given - see below.) 'C' (named for the Unix 'C' locale) matches any language. o a reference to non-empty list of available languages. Here, a language can be like 'en', 'en_CA', or "undef" meaning 'unknown'. The return code is which language to use. This will always be an element of the available languages list. The cleverness of this module (if you can call it that) comes from inferring implicit language preferences based on the explicit list passed in. For example, if you say that en is acceptable, then en_IE and en_DK will presumably be acceptable too (but not as good as just plain en). If you give your language as en_US, then en is almost as good, with the other dialects of en following soon afterwards. If there is a tie between two choices, as when two dialects of the same language are available and neither is explicitly preferred, or when none of the available languages appears in the user's list, then the choice appearing earlier in the available list is preferred. Sometimes, the automatic inferring of related dialects is not what you want, because a language dialect may be very different to the 'main' language, for example Swiss German or some forms of English. For this case, the special form 'XX_*' is available. If you dislike Mexican Spanish (as a completely arbitrary example), then "[ 'es', 'es_*', 'es_MX' ]" would rank this dialect below any other dialect of es (but still acceptable). You don't have to explicitly list every other dialect of Spanish before es_MX. So for example, supposing @avail contains the languages available: o You know English and prefer US English: $which = which_lang([ 'en_US' ], @avail); o You know English and German, German/Germany is preferred: $which = which_lang([ 'en', 'de_DE' ], @avail); o You know English and German, but preferably not Swiss German: $which = which_lang([ 'en', 'de', 'de_*', 'de_CH' ], @avail); Here any dialect of German (eg de_DE, de_AT) is preferable to de_CH. Whereas "which_lang()" picks the best language from a list of alternatives, "acceptable_lang()" answers whether a single language is included (explicitly or implicitly) in the list of wanted languages. It adds the implicit dialects in the same way. AUTHOR
Ed Avis, ed@membled.com SEE ALSO
perl(1). perl v5.8.8 2005-10-17 Preferred(3pm)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy