All Questions
58
questions
3
votes
3
answers
663
views
Bash [[ test =~ regex ]] vs perl command result
Is the bash operator =~ equivalent to a perl invocation?
filename="test-33.csv"
regex="([^.]+)(-\d{1,5})(\.csv)"
With bash test:
if [[ "$filename" =~ $regex ]]; then ...
1
vote
1
answer
400
views
How to find the "pattern" in FASTA file and record the cordinates along with header
I am looking for a solution to search for a string of 17 base pairs in the FASTA file that is the human reference genome.
To clarify, in simple words and put the resources, i have tried grep function ...
0
votes
1
answer
35
views
Perl RexEx Replace locks Apache access_log
I wanted to clean up my apache server logs, remove all the 301, 404, and so on, and after trying and failing with sed, I used Perl, which worked wonderfully, except... Then Apache no longer logs ...
0
votes
2
answers
643
views
Remove the file name from a messy path in a text file awk or sed
I have an xml file with many lines containing something like this:
Save="C:\Users\Administrator\Desktop\my files\1020\A54f\Drawing965.DWG" Module="0"
Save="C:\Users\...
-1
votes
1
answer
157
views
Need to autoincrement directory names but by avoiding some letters in the name
My script creates a set of directories aa, ab, ac, and so on
This script autoincrement directory names but I want to avoid the letters: I, O, P, Q, R, W while creating directories.
The script which I ...
0
votes
1
answer
201
views
Sending args from bash to perl
I eally need help
I would like to send args from bash file to perl file. I dont know why it is not working for me. My code foe testing is bellow
*******bash code *********
#!/usr/bin/env bash
chmod +...
1
vote
1
answer
936
views
How to make fork() fail?
For a script I'm writing, it's important to properly handle a failed fork() (see https://rachelbythebay.com/w/2014/08/19/fork/ for the Why).
But how, without bringing my system down with processes, ...
0
votes
1
answer
81
views
Perl/Bash Solution to Test if a Folder Has Changed, Then Create Copy of It
I'd like to put together a script for a very rudimentary backup system that checks a directory recursively for any changes since the date another directory (the backup) was created and, if it finds ...
1
vote
2
answers
996
views
Regex to substitute character with numbers around it in filenames with rename utility (perl based)
I would like to rename files that have the following format:
somethingblabla15T06:58_31+0000somethingblabla.bla
THe new name should be
somethingblabla15T06:58:31+0000somethingblabla.bla
So the _ ...
0
votes
3
answers
1k
views
sed + how to replace numbers with parenthesis with sed/awk/other
we want to relapse the [1023,1024,1022] as described in the following file , with [1022]
more file.exm
{"topic":"nj_hgf_dfgef","partition":0,"replicas":[1023,1024,1022]},
{"topic":"nj_hgf_dfgef","...
0
votes
1
answer
529
views
awk + print lines only if second field match hours:min:sec
log file is like this
34.3.23.58 07:20:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
34.3.23.58 07:30:01 AM all 0.02 ...
0
votes
0
answers
615
views
perl: warning: Setting locale failed. Centos 6.9
I am receiving the following error message on my Centos linux server for past 15 days.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "...
1
vote
2
answers
83
views
How to globally replace programming code using literal input files?
I will use HTML as an example. But it could be any programming code for any language. This comes up often enough, it would be useful to deal with the literal text code to search and replace.
This is ...
0
votes
1
answer
525
views
Named capture groups from command line
I've come up with the following regular expression:
\[release(\s+(?<release_type>.*))?\]\n+(?<release_notes>.*)
The idea is to parse a commit message for several params:
[release minor]
...
0
votes
0
answers
214
views
Missing site_perl and vendor_perl in bash shell
Whenever I use the terminal in Manjaro KDE, I get a message:
bash: /bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl: No such file or directory
...