tr Questions
2
Solved
I want to remove diacritic signs in some strings. tr/// should do the job but fails (see below). I thought I had an encoding/decoding problem, but I noticed s/// works as I expect. Could somebody e...
3
Solved
I am trying to replace a pipe character in an String with the escaped character in it:
Input: "text|jdbc"
Output: "text\|jdbc"
I tried different things with tr:
echo "text|jdbc" | tr "|" "\\|"
....
3
Solved
I'm pulling some data from a database and one of the strings I'm getting back is in one line and contains multiple instances of the string \n. These are not newline characters; they are literally t...
2
A console program (translate-shell) has an output with colors and uses special decorate characters for this: ^[[22m, ^[[24m, ^[[1m... and so on.
I'd like to remove them to get a plain text.
I tri...
1
I found this example in a Perl tutorial, but could not understand the output. The tutorial says:
The /d modifier deletes the characters matching SEARCHLIST that do not have a corresponding...
5
Solved
Can tr replace one character with two characters?
I am trying to replace "~" with "~\n" but the output does not produce the newline.
$ echo "asdlksad ~ adlkajsd ~ 12345" | tr "~" "~\n"
asdlksad ...
1
Solved
I have a set of several hundred .txt files that I am analyzing (ngram analysis using NSP), and I need to remove all the line breaks from each file. I can do it one at a time using tr:
$ tr -d "\n\...
Spruce asked 7/10, 2014 at 3:18
5
Solved
Let say pattern is string "Love"
input
This is some text
Love this or that
He is running like a rabbit
output
This is some text
Love this or thatHe is running like a rabbit
I've noticed that...
1
Solved
Have output from sed:
http://sitename.com/galleries/83450
72-profile
Those two strings should be merged into one and separated with space like:
http://sitename.com/galleries/83450 72-prof...
2
Solved
my file contains lines such as these:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT
-A INPUT -m state --sta...
9
Solved
Giving the string:
foo='Hello \
World! \
x
we are friends
here we are'
Supose there are also tab characters mixed with spaces after or before the \ character.
I want to replace the spaces, t...
Atmospheric asked 28/2, 2014 at 23:22
1
Solved
My objective is to match email addresses that belong to the Yahoo! family of domains. In *nix systems (I will be using Ubuntu), what are the benefits and drawbacks to any one of these methods for m...
Inextinguishable asked 7/4, 2014 at 22:49
1
Solved
I'm having a little trouble with find and exec in bash:
Suppose I have a bunch of files that I need to replace '\r' characters in. (previous question: Joining Columns on Command Line with Paste o...
1
Solved
4
This is the command I'm using on a standard web page I wget from a web site.
tr '<' '\n<' < index.html
however it giving me newlines, but not adding the left broket in again.
e.g.
echo &q...
1
Solved
I am trying to manipulate a text file and remove non-ASCII characters from the text. I don't want to remove the line. I only want to remove the offending characters. I am trying to get the fo...
5
Solved
I have to replace the newline character with ',' for using in some oracle command but in a single command. I can't figure out how to do it.
Input:
R1
R2
R3
R4
Required Output:
'R1','R2','R3','...
2
Solved
Right now I'm using another text file to store the result of one UNIX command and then using that file to run another command, like so:
tr -d "[,|.]" < text > temporary.txt
tr "[A-Z]" "[a-z]...
5
Solved
5
Solved
Is it possible to delete a specific string with tr command in a UNIX-Shell?
For example: If I type:
tr -d "1."
and the input is 1.1231, it would show 23 as an output, but I want it to show 1231 ...
2
Solved
I have been reading the cookbook for Linux to get a hang of it. I am fairly new to it.
I cam across a topic called Concordance of text. Now I understand what it is, but I am not able to get a seq...
6
Solved
I have a file named file1 with following content:
The answer t
o your question
A conclusive a
nswer isn’t al
ways possible.
When in doubt, ask pe
ople to cite their so
urces, or to explain
Eve...
3
Solved
Our bespoke IDE outputs XML files with an encoding that makes them look like binary files. Diffs and merges of these files fail.
We can create ASCII versions of these files with the tr command. I ...
Jovi asked 29/6, 2011 at 7:33
1
Solved
There is something mysterious to me about the escape status of a backslash within a single quoted string literal as argument of String#tr. Can you explain the contrast between the three examples be...
© 2022 - 2024 — McMap. All rights reserved.