translate or delete characters
1
vote
1answer
32 views
understanding the difference between “-C” and “-c” in tr(1) utility
According to tr(1) manual -C means:
Complement the set of characters in string1, that is ``-C ab'' includes every character except for `a' and `b'.
..and -c means:
Same as -C but complement the ...
-1
votes
1answer
43 views
using tr -t command [comprehension question]
When using tr -t command, string1 should be truncated to the length of string2, right?
tr -t abcdefghijklmn 123 # abc... = string1, 123 = string2
the cellar is the safest place # actual ...
1
vote
4answers
157 views
print last field from line + alternative for awk
Due to technical reason on my Solaris machine, I can't use awk in order to print the last field in line.
What are the other alternatives to awk that print the last field from line (using cut or tr ...
1
vote
1answer
125 views
tr command not working with octal sequences
I need to strip non-ASCII characters off a file. I was using the command -
/usr/xpg4/bin/tr -cd '\0-\177' <non-ASCII_file.dat >ASCII_file.dat
Though it worked in the past, it is not ...
1
vote
2answers
115 views
Redirecting tr stdout to a file [duplicate]
Possible Duplicate:
How can I make iconv replace the input file with the converted output?
Can I read and write to the same file in Linux without overwriting it?
$ cat test.txt
This is a ...
3
votes
1answer
196 views
tr not replacing apostrophe
I want to convert all apostrophes in this file to X:
Bob's book
Bob’s book
Bob′s book # (Might look the same but actually different)
The first apostrophe is replaced as expected:
$ cat file | tr ...
2
votes
2answers
182 views
Piping paths with different types of quotes for slash substitution
I would like to use sed to convert a path with backslashes to the same path with forward slashes:
E.g.
I would like to pipe \\path\to\file\ and obtain /path/to/file
None of the following commands ...
2
votes
3answers
811 views
Why can't tr read from /dev/urandom on OSX?
A colleague suggested creating a random key via the following command:
tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c 32 | xargs
It gave me the error:
tr: Illegal byte ...
0
votes
2answers
233 views
Removing a long string from php files - using grep and sed?
I have encountered some malware on my Linux server, and am trying to remove it from many php files.
I've tried endlessly with grep | sed and grep | tr and couldn't even erase a simple text string, ...
3
votes
2answers
5k views
Removing all spaces, tabs, newlines, etc from a variable?
This is the error I am getting and it's failing because of a variable whose value is supposed to be 2 (I am getting this using a select * from tabel).
I am getting spaces in that variable.
+ 0 !=
...
2
votes
2answers
143 views
what is the benefit of --squeeze-repeats in tr command
What is the benefit of -s or --squeeze-repeats when we use tr? What practical usage?
1
vote
1answer
457 views
Diff similar lines
I'd like to print a list of lines where the first word in two files is identical, and the rest of the words are not. Some complicated mess with comm, grep and cut would be possible, but hopefully ...
2
votes
2answers
185 views
How does tr '[a-z]' '[n-za-m]' work?
I found an obfuscated e-mail address that can be decrypted using this command:
echo "cbyrzba@cbyrzba.bet" | tr '[a-z]' '[n-za-m]'
How does that output a valid e-mail address? What is that command ...
4
votes
3answers
413 views
How do I delete all lines with “.png” in a file?
I've a list of urls of which some point to images:
http://s.thebrighttag.com/iframe?c=A5lqOqP
...
2
votes
3answers
378 views
Is there a tr for translating into longer strings?
tr is great for translating a set of characters to another set of characters. Sometimes, I want to translate a set of characters to a set of strings, e.g. all < and > to < and >.
...
