Questions tagged [text-manipulation]
45 questions
125
votes
17 answers
Linux command to repeat a string n times
Is there any built-in Linux command that allows to output a string that is n times an input string??
GetFree
- 3,230
60
votes
4 answers
Vim: how to paste a block of text at the end of multiple lines?
Say I have a block of text like this:
// Comment1
// Comment2
// Comment3
And I want to append each of these lines to the end of 3 corresponding lines of code:
foo = 1;
bar = 2;
baz = 3;
So that the end result is
foo = 1; // Comment1
bar = 2;…
Tim
- 711
36
votes
7 answers
How to replace multiple spaces by one tab
I have some text files which contain some columns separated by a various number of spaces, but instead I need one single tab as a separator. Is it possible to do in Bash?
user_unknown
- 475
32
votes
12 answers
Efficiently remove the last two lines of an extremely large text file
I have a very large file (~400 GB), and I need to remove the last 2 lines from it. I tried to use sed, but it ran for hours before I gave up. Is there a quick way of doing this, or am I stuck with sed?
Russ Bradberry
- 879
17
votes
7 answers
How can I reverse a line in Notepad++?
Is it possible to reverse a single line in Notepad++?
Example:
Hello world
Would change to
dlrow olleH
Should I install a plugin for such functionality?
UPDATE: I'd like to keep the clipboard in its original state. So a [copy]-[external…
Ron Klein
- 381
8
votes
3 answers
FINDSTR: Line is too long
Windows FINDSTR command is useful for sifting through large amounts of data; it filters out lines of text that match or don't match a specified pattern or string (like GNU/BSD grep).
But it refuses to output lines longer than a certain length. Is…
voices
- 2,881
6
votes
5 answers
How Does One Remove Duplicate Text Lines From Files Larger Than 4GB?
I am looking for an open source (possibly 64 bit) windows text editor that will allow me to remove duplicate lines from an extremely large (4GB+) text file.
What do you use to remove duplicate lines from your large text files?
darkAsPitch
- 1,076
6
votes
3 answers
Remove non-duplicate lines in Linux
how can I remove non-duplicate lines from text file using any linux program linke sed, awk or any other?
Example:
abc
bbc
abc
bbc
ccc
bbc
Result:
abc
bbc
abc
bbc
bbc
Second list have removed ccc because it didn't have duplicate lines.
Is it also…
qlwik
- 63
5
votes
5 answers
How to chain awk print statements?
Okay, here's a quick example; me isolating a host's IPV4 in three steps:
ip -br a
lo UNKNOWN 127.0.0.1/8 ::1/128
eth0 DOWN
wlan0 UP 192.168.0.101/24 fe80::9fcd:45fb:1e0f:a1cc/64…
voices
- 2,881
5
votes
3 answers
Reverse text in Notepad++
This question was asked several years ago without an accepted answer. The question has also long been inactive. Seems a simple piece of functionality, so perhaps a recent plugin provides the feature.
Say I have the text Hello World!. I'd like to…
AlainD
- 5,158
3
votes
2 answers
Is there any way to reverse text and *character* direction in a pure text document?
I have some text in Latin script (English transcription of Farsi) that I would like to display right-to-left in ordinary text documents (and on my iPod) – is that possible? How?
Here’s an example of some text I’d like to reverse (the second row):
تو…
3
votes
3 answers
How can I merge the contents of 2 text files, in Unix?
I need to combine contents of 2 text files, word by word.
The script takes every word from file 1 and combines with file 2.
it adds all the combined words in file 3.
Example:
File1 File2
WordA1 WordB1
WordA2 …
sam
- 31
2
votes
2 answers
how to insert text at the beginning of each paragraph in bash
I have a file with multiple paragraphs separated by blank line. Technically they are not paragraphs just sections of text separated by blank line.
I want to number the paragraphs so to speak by inserting a number in the first line of each line…
OB7
- 203
2
votes
1 answer
Character String Conversion using Python
Hi I have a website that is in Traditional Chinese and when I check the site statistics it tell me that the search term for the website is å%8f°å%8d%97 親å%90é¤%90廳 which obviously makes no sense to me. My question is what is this encoding…
boobami
- 21
2
votes
5 answers
Easiest way to remove unwanted lines from a huge text file
I have a large text file with a size of more than 30 megabytes. I want to remove all the lines which don't match some specific criteria, e.g. lines that don't have the string 'START'.
What's the easiest way to do this?
Shawn
- 437