tr Questions
2
Solved
I am reading some sql queries into a variable from db and it contains new line character (\n). I want to replace \n (new line) with space. I tried solutions provided on internet but was unsuccessfu...
19
Solved
I would like to remove all of the empty lines from a file, but only when they are at the end/start of a file (that is, if there are no non-empty lines before them, at the start; and if there are no...
11
Solved
Am trying to format the below actual output to get in the same line for each disks
0. ct1d0 <INTEL-ADDPF2KX076T9S-2CV1-6.19TB>
/pci@4,0/pci8086,347c@4/e,487c@0/disk@1
/dev/chassis/SYS/DBP/H...
4
Solved
my problem of today is to replace in a string like this --> 6427//6422 6429//6423 6428//6421
every // with a ,. I tried with different commands:
finalString=${startingString//[//]/,} doesn't wor...
Sister asked 7/12, 2014 at 17:55
12
Solved
If I run the command cat file | grep pattern, I get many lines of output. How do you concatenate all lines into one line, effectively replacing each "\n" with "\" " (end with " followed by space)?
...
7
Solved
To remove all newlines you could, say:
tr -d '\n' < days.txt
cat days.txt | tr -d '\n'
but how would you use tr to remove just the newline at the end/bottom of a text file?
I'm not sure to s...
8
Solved
What is the Windows equivalent of the tr command in Linux?
For example, tr can replace all colons with a newline character. Can this be done in Windows?
$ echo $PATH | tr ':' '\n'
/usr/local/bin
...
6
Solved
Currently when I run a grep command on a visitors group that I had created
grep visitors:x:1011: /etc/group
This is a sample result of the above command, as the actual result is too long.
visitors...
3
Solved
I would like to use the tr command to replace all occurrences of the string "\n" with a new line (\n).
I tried tr '\\n' '\n' but this just seems to match any '\' and any 'n'
2
Solved
I'm trying to extract a word list from a Russian short story.
#!/bin/sh
export LC_ALL=ru_RU.utf8
sed -re 's/\s+/\n/g' | \
sed 's/[\.!,—()«»;:?]//g' | \
tr '[:upper:]' '[:lower:]' | \
sort | uniq...
2
Solved
I have this following data set in one file (.txt file)
data1 = 275736 490;data11 = 87551 1004; data2 = 344670 4875; data3 = 472996 840;data4 = 0 0;data = 19708 279;data6 = 10262 18;data7 = 0 0;data...
8
Solved
I'm trying to split sentences in a file into separate lines using a shell script.
Now I would like to split the strings by !, ? or . . The output should be like this :
The file that I want to read ...
3
Solved
I'm doing a bash script and I have a problem. I would like to change the position of two characters in a string.
My input is the following:
"aaaaa_eeeee"
The desired output is:
"eee...
2
Please try the following commands:
echo "(After Sweet Memories) Play Born To Lose Again" | tr '(' '-' | tr ')' '-' | tr ' ' '-'
-After-Sweet-Memories--Play-Born-To-Lose-Again
(notice the ...
1
I have a file that contains strings with newlines, like this:
{"name": "John\n\nMeyer"}
{"name": "Mary\n\nSmith"}
How can I remove them using the tr tool?
I'm trying this, but the output is ba...
4
Solved
I have multiple .txt files containing text in an alphabet; I want to transliterate the text into an other alphabet; some characters of alphabet1 are 1:1 with those of alphabet2 (i.e. a becomes e), ...
5
2
3
Solved
I have a lot of text in lowercase, only problem is, that there is a lot of special characters, which I want to remove it all with numbers too.
Next command it's not strong enough:
tr -cd '[alpha]...
Stylographic asked 28/4, 2016 at 23:12
2
Solved
2
Solved
I am trying to make tr -d remove a string of characters from an existing string, without it removing characters everywhere else.
For example, I want tr to remove : OK from the end of every string i...
3
I would like to know if there is an equivalent to tr/// (as used in Perl) in Java. For example, if I wanted to replace all "s"s with "p"s in "mississippi" and vice versa, I could, in Perl, write
#...
Krute asked 17/9, 2011 at 21:23
3
I am having trouble loading a space delimited text file into a table. The data in this text file is generated by teragen, and hence, is just dummy data, where there are only 2 columns, and the firs...
3
Solved
So I was searching around and using the command tr you can convert from lower case to upper case and vice versa. But is there a way to do this both at once?
So:
$ tr '[:upper:]' '[:lower:]' or $ ...
4
Solved
So Im removing special characters from filenames and replacing with spaces. I have all working apart from files with single backslashes contained therein.
Note these files are created in the Finde...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.