Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 79662

Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.). Check scripts with https://shellcheck.net before posting.

0 votes

Compare 2 files and store the output as file1_value,file2_value,Match/NoMatch

Save this perl script as file xxx an run it with perl xxx file1 file2 #!/usr/bin/perl # save the first two files, the <> slurp clears @ARGV ($f1,$f2) = @ARGV; # build a hash of hash of lines from a …
ingopingo's user avatar
  • 807
1 vote
Accepted

unzip nested .zip files by name shell script

Create a script file like fetchtarget.sh and start it with the URL as first argument. #!/bin/sh dir=$(mktemp -d) cd $dir || exit wget $1 # deep unzip loop while true; do find -iname '*.zip' > z …
ingopingo's user avatar
  • 807
1 vote
Accepted

Find all older versions based on version in filename

You need a compley regex to isolate the moving version string. Delimited the basename with a unused character and sort it unique. For example, build a index file with = as delimter: perl -le 'map { …
ingopingo's user avatar
  • 807
2 votes
Accepted

Script for modifying cronjob

Julies simple solution, stopping and restarting the service as script (Debian Linux): #!/bin/sh service cron stop ... dowhatyouwant ... service cron start Or delete the crontab temporary: crontab …
ingopingo's user avatar
  • 807
0 votes

How can I Print output lines of this script uniqely and for every line print how many times ...

A simple perl script ... #!/usr/bin/perl my %hash; open FH, 'who |' or die; while ( <FH> ) { $hash{$1}++ if /^(\S+).*(10\.\d+\.\d+\.\d+)/; } close FH; while ( ($k,$v) = each %hash ) { printf …
ingopingo's user avatar
  • 807
10 votes

Show sum of file sizes in directory listing

with perl: perl -le 'map { $sum += -s } @ARGV; print $sum' -- *.pdf Size of all non-hidden PDF files in current directory.
ingopingo's user avatar
  • 807