04-09-2009
Trying to display a tab character in variable
Hi,
I'm trying to figure out a way to encapsulate a tab character, or four or five space characters into a string variable to be used in my script. I'm using the bash shell.
I tried
$variablename=" <string text>"
but it didnt give me the output i wanted (output was still justified to left). I tried \t right after the first quote but it printed the \t. I also tried removing the spaces and inserting an actual tab character but got the same result.
Another thing i wondered was if anyone knew how to format a here document so that if i have a line at the end of the here statement that prompts a user to enter a number, the cursor and their input stays on that line.
Any help is appreciated, thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all,
if i do an:
"echo $string |" what should be after the pipe to display ONLY the last char of the output?
tia,
DN2 (9 Replies)
Discussion started by: DukeNuke2
9 Replies
2. UNIX for Dummies Questions & Answers
im having trouble doing this:
i have a variable with 2 characters repeating e.g. aababbbaaaababaabbaabbba
is there a way i can search the variable for a's and b's and then change a's to b's and b's to a's?
im guessing its like getting the 1's compliment of the string
im doing this in... (2 Replies)
Discussion started by: vipervenom25
2 Replies
3. UNIX for Advanced & Expert Users
no problem (6 Replies)
Discussion started by: angelina
6 Replies
4. Shell Programming and Scripting
Hi everybody,
I'm using Hp unix tru64.
I have generate one file from shell script.
bus that file content pre "8 space char" convert one tab character.
why?
result file hex format:
hex 20 20 20 20 20 to 09 (6 Replies)
Discussion started by: Tlg13team
6 Replies
5. Shell Programming and Scripting
Hi,
I am having trouble using the result of the following awk command in a script, as displaying the contents of the placeholder automatically replaces the new created TAB by a space character again:
From the prompt:
cscyabl@comet:(develop)> echo "01 12" | awk '{gsub(" ","\t");print}'
01 ... (2 Replies)
Discussion started by: Indalecio
2 Replies
6. Shell Programming and Scripting
I would like to remove characters from column 7 so that from an input file looking like this:
>HWI-EAS422_12:4:1:69:89 GGTTTAAATATTGCACAAAAGGTATAGAGCGT U0 1 0 0 ref_chr8.fa 6527777 F DD
I get something like that in an output file:
... (13 Replies)
Discussion started by: matlavmac
13 Replies
7. UNIX for Dummies Questions & Answers
I would like to display the last 8 characters of the filenames for filenames of different lengths.
I can delete the last 8 characters with sed but dont know how to only show the last 8 characters.
The filenames are something like;
afxH340800340000
afxH30800340021
afxR3080034002122
I... (3 Replies)
Discussion started by: Beanz
3 Replies
8. UNIX for Dummies Questions & Answers
I am trying to remove the tab character from a file, which occurs on two places in every line. So far I have tried the following and most are from threads in this forum:
sed -i '' -e 's/ / /' file.dat
sed -i '' -e 's/*/ /' file.dat
sed -i '' -e 's/\t*/ /g' file.dat
sed -i '' -e 's/*//g'... (4 Replies)
Discussion started by: figaro
4 Replies
9. Shell Programming and Scripting
Hello.
I am using :
sed -i -e '/§name_script§/a#'"${MY_TAB11}"'# \
#'"${MY_TAB1}"'The Standard way'"${MY_TAB7}"'# \
#'"${MY_TAB1}"'==============='"${MY_TAB7}"'# \ ' "$CUR_FILE"
Is there a better way to define "MY_TAB7","MY_TAB11" in other way than :
MY_TAB1=$'\t'
MY_TAB2=${MY_TAB1}$'\t'... (2 Replies)
Discussion started by: jcdole
2 Replies
10. Shell Programming and Scripting
I have a Zsh script which invokes another program. One of the paramters to be passed, should be a literal tab, i.e what in common programming languages is often written as "\t".
If it were bash, I think I could use the special form
$"\t"
but this doesn't seem to work (the called program... (5 Replies)
Discussion started by: rovf
5 Replies
LEARN ABOUT DEBIAN
utf8trans
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)