Skip to main content

All Questions

Tagged with
2 votes
3 answers
821 views

ARGV[] not accepting the argument

I have a shell script that I am trying to pass a date argument to ARGV[1] but the script is giving a blank output Here is the command: #!/bin/bash dt=$(date -d "yesterday" '+%m%d%Y') cat /...
NecroCoder's user avatar
-1 votes
3 answers
152 views

Replace new lines at end for those lines whose 2nd field in colon separated file span over to multiple line

I have got multiple files with different set of contents but the pattern is same across mulitple lines in different files. sample input file : cat -n test.txt 1 adjfkhjdhfkjd: ...
Ashis Sahoo's user avatar
2 votes
0 answers
100 views

Processing large blocklists with GNU Parallel

This is an ongoing project that has undergone a major update to speed up list processing. Here is the homepage for anyone interested! It processes lists defined in lists.json by transforming the list ...
T145's user avatar
  • 213
3 votes
1 answer
274 views

Different encoding/Unicode interpretation using terminal vs using shell script

I was working on a keymap script (map keys from one language keyboard layout to another). And after a lot of hard time trying to get everything working I found out that different characters are ...
Andrew15_5's user avatar
5 votes
5 answers
780 views

How can I replace multiple substrings from multiple lines in a file matching a pattern from a different file?

I have a file that contains multiple IP addresses and hostnames, and another file that contains some folders with many IP addresses per line. ip_hostname.txt host1 10.1.1.1 host2 10.2.2.2 host3 10.3.3....
Outsider's user avatar
-2 votes
1 answer
89 views

Organising column and items based on corresponding value from different column

I have a large input.csv file that has 2 columns: Category (column A) and Item (column B), each Item having that specific Category found on column A and one row higher than the group itself; ex: rows ...
Lernisios's user avatar
1 vote
4 answers
846 views

comment the specific line in fstab file that contained the relevant UUID number

We want to comment the specific line in fstab file that contained the relevant UUID number Example: Disk=sde UUID_STRING=` blkid | grep $Disk | awk '{print $2}' ` echo $UUID_STRING UUID="...
yael's user avatar
  • 13.4k
3 votes
2 answers
1k views

Find a pattern (of a child tag) and replace the entire parent tag at XML files, without using sed tool [duplicate]

Is there a way to find a pattern (of a child tag) and replace the entire parent tag, using regular expressions?  I'm working from a Linux server without a graphics environment. I have XML like: <?...
oswaldog's user avatar
-1 votes
1 answer
1k views

sh + how to send cntrl c and then enter yes to accept license

I need to enter CNTRL C and then I need to enter yes , in order to accept license now I am thinking how to automate this process can we automate this process as run the sh script and entering CNTRL C ...
yael's user avatar
  • 13.4k
-1 votes
3 answers
970 views

perl - how to convert hh:mm:ss to seconds

Is there a way in perl to convert a duration (hh:mm:ss) to total number of seconds? sample: 02:50:30 output: 10230
zorro88's user avatar
  • 11
0 votes
1 answer
826 views

Capturing hostname & data when executing local script on remote server

While trying to execute a local script on remotely host unable to get hostname of the remoteserver to a local output file. For example I am executing a script below. ssh remotehost sh -s < sudo su -...
AReddy's user avatar
  • 3,170
1 vote
1 answer
200 views

/home/biol/perl5: Is a directory

the below script crashed: #!/bin/bash #usage: sh oxford_pbs.sh ref.fa AA.fasta hybrid.gff3 cov=50 ide=100 for ((i=70;i<=${ide};i++)); do input=$(basename $(echo ${2} | sed 's|.gff3||g')) #...
user977828's user avatar
-1 votes
3 answers
1k views

Perl script from Ubuntu doesn't run on Debian

I have a Perl script which I created on Ubuntu 20.04 LTS. It's okay and works. I took this script on another machine with Debian on it. It doesn't run with: ./my_script.pl This gave me: ./my_script....
J M Kane's user avatar
3 votes
5 answers
3k views

How to achieve an early exit from a code block in a bash script (analogous to perl's `last` directive)?

One feature of Perl that I really like is its generalization of looping control keywords to any curly-brace-delimited lexical block1. For example, one can use Perl's last directive to exit any such ...
kjo's user avatar
  • 15.6k
0 votes
4 answers
280 views

how to capture parameter and value from line

we want to capture only the parameter - segment.bytes and his value example echo "$info" | grep "segment.bytes" {"version":1,"config":{"segment.bytes":...
yael's user avatar
  • 13.4k

15 30 50 per page
1
2 3 4 5
9