Manipulation of text by programs, scripts, etc.
1
vote
1answer
9 views
Linux one-liner to find the largest recurring group of lines in a text file?
I have a log containing an execution trace where there is infinite recursion eventually terminating when the stack is too deep. There are enough lines and valid included recursion within the larger ...
-1
votes
1answer
25 views
remove apostrophes and other marks files from apostrophes
How to remove apostrophes and other marks such as (Parkinson’s and Parkinson's ) from all text files in a directory and save the changes in each one of the files as in the directory
0
votes
4answers
62 views
How to find and replace string without use command Sed?
As we all know, sed is greatly efficient to find and replace string, for example find 'a'
and replace it to 'b': sed 's/a/b/g'.
Is it possible to do this with other command or shell script instead ...
2
votes
3answers
64 views
using sed to replace pattern with hash values
I want to search the file and replace specific pattern with its hash (SHA1) values.
For example, let file.txt has the following content:
one S56G one two three
four five V67X six
and I want to ...
5
votes
2answers
55 views
How to report “sed” in-place changes
When using sed to replace strings in-place, is there a way to make it report the changes it does (without relying on a diff of old and new files)?
For instance, how can I change the command line
...
1
vote
1answer
52 views
C shell script : how do I compare two strings?
I'm a C shell user.
I've two files.
file 1:
A
B
C
D
E
file 2:
A
C
B
D
E
I want to compare only A-A, B-C, C-B, D-D, E-E using a for loop.
If the strings match, then print "match".
The output ...
3
votes
2answers
51 views
awk read error bad address
I have a file that is roughly 30GB. I am using,
awk ' $1 <= 2000 ' myfile.txt >> myfile_new.txt
But, I get this error after a while -
awk: read error (Bad address)
I guess this is ...
0
votes
1answer
31 views
Formatting quotes from the fortune to use it with conky
I'm using fortune cookie outputs in my conky script.
My fortune output is in the following format:
Text1 : Some message including( line break tags, e.g. and comma(,),=,semicolon(;) like ...
3
votes
2answers
79 views
Bash-script. Shift seconds
Maybe somebody can help me. In bash I don't know how to do that. I need to do a bash-script. At stdin I have .srt file of subtitles in this format:
num
HH:MM:SS,SSS --> HH:MM:SS,SSS
text line 1
...
4
votes
1answer
52 views
Extract data from two files
I have two files as given below
Output1.csv
201319107648361,12:27:04,12:27:14,0:0:10 secs
201319109089878,12:27:04,12:27:15,0:0:11 secs
201319108968961,12:27:15,12:27:54,0:0:9 secs
...
1
vote
1answer
40 views
Binary search for a failing line
git has bisect run to figure out which revision an error was introduced.
I have a big file (100GB) and at least one of the lines is bad, but the program I have to check it with will not tell me which ...
5
votes
2answers
64 views
Lowercase all but the first (Uppercase) letter from UPPERCASE in cyrillic
To make all letters a lower case except the first letter. The first letter would look like "Uppercase" after I changed (from UPPERCASE in cyrillic). The rest (not UPPERCASED) leave unchanged.
I'm ...
0
votes
2answers
67 views
Show only part of the line found by grep (but not the part that matches the pattern)
In ifcfg-eth0, I managed to grep "DEVICE=eth0" by using
grep "DEVICE=" ifcfg-eth0
But how can I grep pattern to show only "eth0"?
3
votes
5answers
100 views
How to align fstab entries easily
Editing /etc/fstab with my text editor makes all the spacing go out of alignment. I could go through the file and insert/delete spaces to line everything up, but I'm looking for a more automated ...
2
votes
5answers
57 views
Sum the values in a column except the header
I have a file as given below
--------------------------------------------------------------
Name_Customer Item_Purchased Item_Amount Credit
...