Sponsored Content
Full Discussion: string concatenation
Top Forums UNIX for Dummies Questions & Answers string concatenation Post 302070327 by matrixmadhan on Tuesday 4th of April 2006 05:26:43 AM
Old 04-04-2006
with sed,
Code:
sed 's/\(....\) \(.*\)/\1;\2/' filename

with awk,
Code:
awk '{ 
for(x=1; x<=NF; x++) 
{
if ( x==1 )
{
  printf $x";";
}
else
{
  printf $x" ";
}
}
printf "\n";
}' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help concatenation string and variable

Hello, in my script i have this lines of code in a while cycle: .. let j=i+1 t_prod_$i = `cat myfile.csv | grep world | cut -d ";" -f$j` let i+=1 ... So if i try an echo $t_prod_$i at the end of the cycle i cannot see the right value obtained by `cat myfile.csv | grep world |... (5 Replies)
Discussion started by: drain
5 Replies

2. Shell Programming and Scripting

String concatenation with spaces

Hi, I have a variable $ID=40 and I need to build a string like 40 40 40 40 40 40 so repeating ID 'n' times separated by spaces. Any help? Thanks Sarah (2 Replies)
Discussion started by: f_o_555
2 Replies

3. Shell Programming and Scripting

String Concatenation

Hi All, I need to concatenate the values in the array into a variable. Currently the code is : for (( i=1 ; i <= $minCount ; i++ )) do var="${var}""${sample_file}" done The output is : /tmp/1/tmp/2/tmp/3/tmp/4/tmp/5/tmp/6/tmp/7/tmp/8/tmp/9/tmp/10 I need a space between... (1 Reply)
Discussion started by: sh_kk
1 Replies

4. Shell Programming and Scripting

String/Variable Concatenation

Hello, Trying to concatenate the following using bourne shell: # !/bin/bash # this works in bash shell e.g. get the results I am expecting fnTmp=C$cindex.$station_0.$station_1.$station_3.$ts.tmp # # under !/bin/sh # the results are not the same Any assistance would be... (8 Replies)
Discussion started by: LAVco
8 Replies

5. Shell Programming and Scripting

String concatenation problems

#! /bin/csh set tt=12345_UMR_BH452_3_2.txt set rr=`echo $tt | cut -d_ -f1` set rr1=welcome set ff=$rr $rr1 echo $ff why $ff returned only 12345 and not 12345welcome? thanks (2 Replies)
Discussion started by: jdsignature88
2 Replies

6. Shell Programming and Scripting

String / Variable Concatenation

Hi all, I'm trying to build a variable name automatically through a for loop for a script I'm working on, basically I want to build the variables named: $JVM_HOME0 or $JVM_HOME1 so that I can loop through some file copy/deletes and a server restart once completed. With the code below, I get this... (3 Replies)
Discussion started by: hydroponx
3 Replies

7. Shell Programming and Scripting

String concatenation

Hi, I have two files. cat file.txt a b c d cat file1.txt j k l m I need the output as a:j (12 Replies)
Discussion started by: nareshkumar522
12 Replies

8. Shell Programming and Scripting

String concatenation problem

Hi there, I'm writing a basic script where I want to make a string of 2 numeric fields from a file, which I have done, but the behavior is rather confusing. I have a file of random values such as: 1 2 3 4 5 6 7 8 9 10 and my awk code is: BEGIN { FS = " " } { str = str $1 $2 } END {... (7 Replies)
Discussion started by: HMChadwick
7 Replies

9. Shell Programming and Scripting

Group by and string concatenation

Hi, I was trying to work on a file which had the following data format 1 hi 1 this 1 is 1 john 2 hello 3 test 3 case the expected output file is the below 1 hi, this, is, john 2 hello 3 test, case I tried using awk or while read, but I couldnt... (13 Replies)
Discussion started by: karthikbhuvana
13 Replies

10. Shell Programming and Scripting

Help with String concatenation

I have a script which is migrated from AIX to Linux & now while running it is no able to concatenate string values The string concatenation step under while loop is not displaying desired result Please find below the piece of code: while read EXT_FILE ; do EXT_FILE=$EXT_FILE.ext.sent echo... (7 Replies)
Discussion started by: PreetArul
7 Replies
utf8trans(1)							     docbook2X							      utf8trans(1)

NAME
utf8trans - Transliterate UTF-8 characters according to a table SYNOPSIS
utf8trans charmap [file]... DESCRIPTION
utf8trans transliterates characters in the specified files (or standard input, if they are not specified) and writes the output to standard output. All input and output is in the UTF-8 encoding. This program is usually used to render characters in Unicode text files as some markup escapes or ASCII transliterations. (It is not in- tended for general charset conversions.) It provides functionality similar to the character maps in XSLT 2.0 (XML Stylesheet Language - Transformations, version 2.0). OPTIONS
-m, --modify Modifies the given files in-place with their transliterated output, instead of sending it to standard output. This option is useful for efficient transliteration of many files at once. --help Show brief usage information and exit. --version Show version and exit. USAGE
The translation is done according to the rules in the 'character map', named in the file charmap. It has the following format: 1. Each line represents a translation entry, except for blank lines and comment lines, which are ignored. 2. Any amount of whitespace (space or tab) may precede the start of an entry. 3. Comment lines begin with #. Everything on the same line is ignored. 4. Each entry consists of the Unicode codepoint of the character to translate, in hexadecimal, followed one space or tab, followed by the translation string, up to the end of the line. 5. The translation string is taken literally, including any leading and trailing spaces (except the delimeter between the codepoint and the translation string), and all types of characters. The newline at the end is not included. The above format is intended to be restrictive, to keep utf8trans simple. But if a XML-based format is desired, there is a xmlcharmap2utf8trans script that comes with the docbook2X distribution, that converts character maps in XSLT 2.0 format to the utf8trans format. LIMITATIONS
o utf8trans does not work with binary files, because malformed UTF-8 sequences in the input are substituted with U+FFFD characters. Howev- er, null characters in the input are handled correctly. This limitation may be removed in the future. o There is no way to include a newline or null in the substitution string. AUTHOR
Steve Cheng <stevecheng@users.sourceforge.net>. docbook2X 0.8.8 3 March 2007 utf8trans(1)
All times are GMT -4. The time now is 10:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy