Sponsored Content
Top Forums Shell Programming and Scripting Bash - Inserting non printable character(s) in string variable Post 302962770 by RudiC on Friday 18th of December 2015 06:25:57 AM
Old 12-18-2015
Not sure I understand. You want to eliminate non-printable chars from a string?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash script to check the first character in string

Hello would appreciate if somebody can post a bash script that checks if the first character of the given string is equal to, say, "a" thnx in advance (2 Replies)
Discussion started by: ole111
2 Replies

2. Shell Programming and Scripting

inserting a character between string

i have a file contains like this: i want to create a script that will insert a comma "." after the 10th character so it would be look like this thanks in advance (5 Replies)
Discussion started by: dakid
5 Replies

3. Shell Programming and Scripting

Inserting newline in front of multi-character string

I'm working with a large file with multiple records, each record begins with ISA. The issue is, sometimes ISA is at the start of the line, sometimes it's in the middle of the line. So before I can csplit my main file into multiple records, I have to get each record header onto its own line. ... (7 Replies)
Discussion started by: verge
7 Replies

4. Shell Programming and Scripting

Check whether there is a non printable character in the unix variables

cp $l_options $srcdirfile $destdirfile If i want to check whether there is a non printable character in the variables $l_options $srcdirfile $destdirfile how it can be done? (2 Replies)
Discussion started by: lalitpct
2 Replies

5. Shell Programming and Scripting

Bash - get specific character from the string

Hi! If I want to extract a character from a specific position of a string, I can use ${string:1:1} (if I want character at the position 1). How can I do the same thing, when the number of position is contained in the variable? ${string:$var:1}doesn't work, unfortunately. Thanks in advance. (2 Replies)
Discussion started by: xqwzts
2 Replies

6. Shell Programming and Scripting

Bash: How to remove the last character of a string?

In bash, how can one remove the last character of a string? In perl, the chop function would remove the last character. However, I do not know how to do the same job in bash. Many thanks in advance. (12 Replies)
Discussion started by: LessNux
12 Replies

7. Shell Programming and Scripting

[Solved] SED - Bash - Inserting multi Tab character in the command

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

8. Shell Programming and Scripting

Bash: Pulling first and last character in string

I am writing a bash script that will find all references to the “Well_List” in the “Comp_File”. I am filtering a Well_List that contains the following: TEST_WELL_01 TEST_WELL_02 TEST_WELL_11 TEST_WELL_22 GOV_WELL_1 GOV_WELL_201 PUB_WELL_57 PUB_WELL_82 . . Comparison... (5 Replies)
Discussion started by: petfyp
5 Replies

9. Shell Programming and Scripting

Inserting a non printable character in a file

For some testing I want to insert a non printable character in a file. How to do it? I inserted ctrl-v ctrl-k through vi. But I do not think it is a proper non printable character. (3 Replies)
Discussion started by: Soham
3 Replies

10. UNIX for Beginners Questions & Answers

Escape bash-special character in a bash string

Hi, I am new in bash scripting. In my work, I provide support to several users and when I connect to their computers I use the same admin and password, so I am trying to create a script that will only ask me for the IP address and then connect to the computer without having me to type the user... (5 Replies)
Discussion started by: arcoa05
5 Replies
textutil::adjust(3tcl)				    Text and string utilities, macro processing 			    textutil::adjust(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
textutil::adjust - Procedures to adjust, indent, and undent paragraphs SYNOPSIS
package require Tcl 8.2 package require textutil::adjust ?0.7.1? ::textutil::adjust::adjust string ?option value...? ::textutil::adjust::readPatterns filename ::textutil::adjust::listPredefined ::textutil::adjust::getPredefined filename ::textutil::adjust::indent string prefix ?skip? ::textutil::adjust::undent string _________________________________________________________________ DESCRIPTION
The package textutil::adjust provides commands that manipulate strings or texts (a.k.a. long strings or string with embedded newlines or paragraphs), adjusting, or indenting them. The complete set of procedures is described below. ::textutil::adjust::adjust string ?option value...? Do a justification on the string according to the options. The string is taken as one big paragraph, ignoring any newlines. Then the line is formatted according to the options used, and the command returns a new string with enough lines to contain all the printable chars in the input string. A line is a set of characters between the beginning of the string and a newline, or between 2 newlines, or between a newline and the end of the string. If the input string is small enough, the returned string won't contain any newlines. Together with ::textutil::adjust::indent it is possible to create properly wrapped paragraphs with arbitrary indentations. By default, any occurrence of space or tabulation characters are replaced by a single space so that each word in a line is separated from the next one by exactly one space character, and this forms a real line. Each real line is placed in a logical line, which has exactly a given length (see the option -length below). The real line may be shorter. Again by default, trailing spaces are ignored before returning the string (see the option -full below). The following options may be used after the string parameter, and change the way the command places a real line in a logical line. -full boolean If set to false (default), trailing space characters are deleted before returning the string. If set to true, any trailing space characters are left in the string. -hyphenate boolean If set to false (default), no hyphenation will be done. If set to true, the command will try to hyphenate the last word of a line. Note: Hyphenation patterns must be loaded prior, using the command ::textutil::adjust::readPatterns. -justify center|left|plain|right Sets the justification of the returned string to either left (default), center, plain or right. The justification means that any line in the returned string but the last one is build according to the value. If the justification is set to plain and the number of printable chars in the last line is less than 90% of the length of a line (see the option -length), then this line is justified with the left value, avoiding the expansion of this line when it is too small. The meaning of each value is: center The real line is centered in the logical line. If needed, a set of space characters are added at the beginning (half of the needed set) and at the end (half of the needed set) of the line if required (see the option -full). left The real line is set on the left of the logical line. It means that there are no space chars at the beginning of this line. If required, all needed space chars are added at the end of the line (see the option -full). plain The real line is exactly set in the logical line. It means that there are no leading or trailing space chars. All the needed space chars are added in the real line, between 2 (or more) words. right The real line is set on the right of the logical line. It means that there are no space chars at the end of this line, and there may be some space chars at the beginning, despite of the -full option. -length integer Set the length of the logical line in the string to integer. integer must be a positive integer value. Defaults to 72. -strictlength boolean] If set to false (default), a line can exceed the specified -length if a single word is longer than -length. If set to true, words that are longer than -length are split so that no line exceeds the specified -length. ::textutil::adjust::readPatterns filename Loads the internal storage for hyphenation patterns with the contents of the file filename. This has to be done prior to calling command ::textutil::adjust::adjust with "-hyphenate true", or the hyphenation process will not work correctly. The package comes with a number of predefined pattern files, and the command ::textutil::adjust::listPredefined can be used to find out their names. ::textutil::adjust::listPredefined This command returns a list containing the names of the hyphenation files coming with this package. ::textutil::adjust::getPredefined filename Use this command to query the package for the full path name of the hyphenation file filename coming with the package. Only the filenames found in the list returned by ::textutil::adjust::listPredefined are legal arguments for this command. ::textutil::adjust::indent string prefix ?skip? Each line in the string is indented by adding the string prefix at its beginning. The modified string is returned as the result of the command. If skip is specified the first skip lines are left untouched. The default for skip is 0, causing the modification of all lines. Neg- ative values for skip are treated like 0. In other words, skip > 0 creates a hanging indentation. Together with ::textutil::adjust::adjust it is possible to create properly wrapped paragraphs with arbitrary indentations. ::textutil::adjust::undent string The command computes the common prefix for all lines in string consisting solely out of whitespace, removes this from each line and returns the modified string. Lines containing only whitespace are always reduced to completely empty lines. They and empty lines are also ignored when computing the prefix to remove. Together with ::textutil::adjust::adjust it is possible to create properly wrapped paragraphs with arbitrary indentations. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category textutil of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. SEE ALSO
regexp(3tcl), split(3tcl), string(3tcl) KEYWORDS
TeX, adjusting, formatting, hyphenation, indenting, justification, paragraph, string, undenting CATEGORY
Text processing textutil 0.7.1 textutil::adjust(3tcl)
All times are GMT -4. The time now is 03:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy