Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Append characters to end of line Post 302415090 by sam12345 on Wednesday 21st of April 2010 05:26:38 PM
Old 04-21-2010
Thanks Corona,

I basically copied the code.. it works please could you explain what is happening.

I mean to say what is
Code:
IFS="" read LINE

while [ "${#LINE}" -lt 100 ] 
do LINE="${LINE}0" 
done 
echo "${LINE}"


Thanks

Last edited by Scott; 04-21-2010 at 06:37 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to append words at the end of first line

Hi Unix gurus This is my first post here. I have a file which looks like this: string1,string2 ,string3 ,string4 ... ... I need to append all words below first line to the first line, ie string1,string2,string3,string4,... Bear in mind that it is not known how many lines follow... (11 Replies)
Discussion started by: lmatlebyane
11 Replies

2. Shell Programming and Scripting

append a character at end of each line of a file

Hi, i want to append a character '|' at end of each line of a file abc.txt. for example if the file abc.txt conatins: a|b|c 1|2|33 w|2|11 i want result file xyz.txt a|b|c| 1|2|33| w|2|11| I know this is simple but sumhow i am not able to reach end of line. its urgent, thanks for... (4 Replies)
Discussion started by: muaz
4 Replies

3. Shell Programming and Scripting

how to append the pattern at the end of the line

-Hi I have multiple files which contain a line with the word "exec". I need to add the following pattern " -cmode -ccheap" on the same line where "exec" is at the end. Any idea? Thanks a lot in advance to everybody... -A (2 Replies)
Discussion started by: aoussenko
2 Replies

4. Shell Programming and Scripting

append end of line with 8 spaces

child_amt=$amount prev_line="$prev_line $child_amt" i am getting the result like this 21234567890001343 000001004OLFXXX029100020091112 0000060 but i want 8 spaces between the eg: 21234567890001343 000001004OLFXXX029100020091112 0000060 how can i do this in .ksh (1 Reply)
Discussion started by: kshuser
1 Replies

5. Shell Programming and Scripting

Append text to end of line on all lines

Hi, I've spent some time researching for this but can't seem to find a solution. I have a file like this 1234|Test|20101111|18:00|19:00There will be multiple lines in the file with the same kind of format. For every line I need to make it this 1234|Test|20101111|18:00|19:00||create... (5 Replies)
Discussion started by: giles.cardew
5 Replies

6. Shell Programming and Scripting

Append text to end of every line

I've scoured the internet with mixed results. As an amateur I turn to the great minds here. I have a text file of 80 or so lines. I want to add ".pdf" to the end of each line. (For now that's it) Most of the internet points toward using "sed". I don't know coding but can figure things out... (4 Replies)
Discussion started by: spacebase
4 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

Help Needed! - Cut characters after a text string and append to end of filename

Hi all.. I have several unique files that contain one thing in common, and that is acct#. For all files in the directory, I want to append the 10 characters following the word "ACCOUNT:" to the end of the filename. for example: I have file 111_123 that contains ACCOUNT:ABC1234567 The file... (5 Replies)
Discussion started by: cinderella1
5 Replies

9. Shell Programming and Scripting

Append this string to end of each line

Platform: Solaris 10 I have a file like below $ cat languages.txt Spanish Norwegian English Persian German Portugese Chinese Korean Hindi Malayalam Bengali Italian Greek Arabic I want to append the string " is a great language" at end of each line in this file. (3 Replies)
Discussion started by: omega3
3 Replies

10. Shell Programming and Scripting

Append Pipes at the end of each line

Hi , I have pipe delimited file containing 12 columns having below data in AIX Input : A|B|C|D|E|F|G|H|I|J|K|L^M A1|B1|C1|D1|E1^M A2|B2|C2^M So in first row i have 11 pipes which is fine. In second row I have 4 pipes, so additional 7 pipes should get append In third row I have 2... (3 Replies)
Discussion started by: sonu_pal
3 Replies
charnames(3pm)						 Perl Programmers Reference Guide					    charnames(3pm)

NAME
charnames - define character names for "N{named}" string literal escapes SYNOPSIS
use charnames ':full'; print "N{GREEK SMALL LETTER SIGMA} is called sigma. "; use charnames ':short'; print "N{greek:Sigma} is an upper-case sigma. "; use charnames qw(cyrillic greek); print "N{sigma} is Greek sigma, and N{be} is Cyrillic b. "; use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE", }; print "N{e_ACUTE} is a small letter e with an acute. "; print charnames::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE" printf "%04X", charnames::vianame("GOTHIC LETTER AHSA"); # prints "10330" DESCRIPTION
Pragma "use charnames" supports arguments ":full", ":short", script names and customized aliases. If ":full" is present, for expansion of "N{CHARNAME}" string "CHARNAME" is first looked in the list of standard Unicode names of chars. If ":short" is present, and "CHARNAME" has the form "SCRIPT:CNAME", then "CNAME" is looked up as a letter in script "SCRIPT". If pragma "use charnames" is used with script name arguments, then for "N{CHARNAME}" the name "CHARNAME" is looked up as a letter in the given scripts (in the specified order). Customized aliases are explained in "CUSTOM ALIASES". For lookup of "CHARNAME" inside a given script "SCRIPTNAME" this pragma looks for the names SCRIPTNAME CAPITAL LETTER CHARNAME SCRIPTNAME SMALL LETTER CHARNAME SCRIPTNAME LETTER CHARNAME in the table of standard Unicode names. If "CHARNAME" is lowercase, then the "CAPITAL" variant is ignored, otherwise the "SMALL" variant is ignored. Note that "N{...}" is compile-time, it's a special form of string constant used inside double-quoted strings: in other words, you cannot use variables inside the "N{...}". If you want similar run-time functionality, use charnames::vianame(). For the C0 and C1 control characters (U+0000..U+001F, U+0080..U+009F) as of Unicode 3.1, there are no official Unicode names but you can use instead the ISO 6429 names (LINE FEED, ESCAPE, and so forth). In Unicode 3.2 (as of Perl 5.8) some naming changes take place ISO 6429 has been updated, see "ALIASES". Also note that the U+UU80, U+0081, U+0084, and U+0099 do not have names even in ISO 6429. Since the Unicode standard uses "U+HHHH", so can you: "N{U+263a}" is the Unicode smiley face, or "N{WHITE SMILING FACE}". CUSTOM TRANSLATORS
The mechanism of translation of "N{...}" escapes is general and not hardwired into charnames.pm. A module can install custom translations (inside the scope which "use"s the module) with the following magic incantation: use charnames (); # for $charnames::hint_bits sub import { shift; $^H |= $charnames::hint_bits; $^H{charnames} = &translator; } Here translator() is a subroutine which takes "CHARNAME" as an argument, and returns text to insert into the string instead of the "N{CHARNAME}" escape. Since the text to insert should be different in "bytes" mode and out of it, the function should check the current state of "bytes"-flag as in: use bytes (); # for $bytes::hint_bits sub translator { if ($^H & $bytes::hint_bits) { return bytes_translator(@_); } else { return utf8_translator(@_); } } CUSTOM ALIASES
This version of charnames supports three mechanisms of adding local or customized aliases to standard Unicode naming conventions (:full) Anonymous hashes use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE", }; my $str = "N{e_ACUTE}"; Alias file use charnames ":full", ":alias" => "pro"; will try to read "unicore/pro_alias.pl" from the @INC path. This file should return a list in plain perl: ( A_GRAVE => "LATIN CAPITAL LETTER A WITH GRAVE", A_CIRCUM => "LATIN CAPITAL LETTER A WITH CIRCUMFLEX", A_DIAERES => "LATIN CAPITAL LETTER A WITH DIAERESIS", A_TILDE => "LATIN CAPITAL LETTER A WITH TILDE", A_BREVE => "LATIN CAPITAL LETTER A WITH BREVE", A_RING => "LATIN CAPITAL LETTER A WITH RING ABOVE", A_MACRON => "LATIN CAPITAL LETTER A WITH MACRON", ); Alias shortcut use charnames ":alias" => ":pro"; works exactly the same as the alias pairs, only this time, ":full" is inserted automatically as first argument (if no other argument is given). charnames::viacode(code) Returns the full name of the character indicated by the numeric code. The example print charnames::viacode(0x2722); prints "FOUR TEARDROP-SPOKED ASTERISK". Returns undef if no name is known for the code. This works only for the standard names, and does not yet apply to custom translators. Notice that the name returned for of U+FEFF is "ZERO WIDTH NO-BREAK SPACE", not "BYTE ORDER MARK". charnames::vianame(name) Returns the code point indicated by the name. The example printf "%04X", charnames::vianame("FOUR TEARDROP-SPOKED ASTERISK"); prints "2722". Returns undef if the name is unknown. This works only for the standard names, and does not yet apply to custom translators. ALIASES
A few aliases have been defined for convenience: instead of having to use the official names LINE FEED (LF) FORM FEED (FF) CARRIAGE RETURN (CR) NEXT LINE (NEL) (yes, with parentheses) one can use LINE FEED FORM FEED CARRIAGE RETURN NEXT LINE LF FF CR NEL One can also use BYTE ORDER MARK BOM and ZWNJ ZWJ for ZERO WIDTH NON-JOINER and ZERO WIDTH JOINER. For backward compatibility one can use the old names for certain C0 and C1 controls old new HORIZONTAL TABULATION CHARACTER TABULATION VERTICAL TABULATION LINE TABULATION FILE SEPARATOR INFORMATION SEPARATOR FOUR GROUP SEPARATOR INFORMATION SEPARATOR THREE RECORD SEPARATOR INFORMATION SEPARATOR TWO UNIT SEPARATOR INFORMATION SEPARATOR ONE PARTIAL LINE DOWN PARTIAL LINE FORWARD PARTIAL LINE UP PARTIAL LINE BACKWARD but the old names in addition to giving the character will also give a warning about being deprecated. ILLEGAL CHARACTERS
If you ask by name for a character that does not exist, a warning is given and the Unicode replacement character "x{FFFD}" is returned. If you ask by code for a character that does not exist, no warning is given and "undef" is returned. (Though if you ask for a code point past U+10FFFF you do get a warning.) BUGS
Since evaluation of the translation function happens in a middle of compilation (of a string literal), the translation function should not do any "eval"s or "require"s. This restriction should be lifted in a future version of Perl. perl v5.8.0 2002-06-01 charnames(3pm)
All times are GMT -4. The time now is 07:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy