Questions tagged [text-manipulation]
44 questions
113
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,040
- 10
- 40
- 47
51
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
- 621
- 1
- 6
- 5
34
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
- 445
- 2
- 5
- 5
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
- 5
- 12
- 21
16
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
- 371
- 2
- 4
- 12
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,651
- 8
- 29
- 47
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,056
- 6
- 18
- 29
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
- 1
- 3
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,651
- 8
- 29
- 47
4
votes
2 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
- 4,447
- 15
- 49
- 96
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
- 193
- 1
- 1
- 6
2
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):
تو…
Elias Mossholm
- 33
- 1
- 7
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
- 1
- 6
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
- 5
- 16
2
votes
1 answer
What's the best method for JPEG text manipulation?
I have a relatively simple graphic; a technical diagram with various bits of text throughout.
The text is in another language (Czech/Slovak). It's printed clearly enough to be accurately distinguished and interpreted by (Android) Google Translate's…
voices
- 2,651
- 8
- 29
- 47