This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| perl -MGitHub::Jobs -e 'print $INC{"GitHub/Jobs.pm"}' or perldoc -l GitHub::Jobs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #SED If a line begins with an [A-Z], append it to the previous line | |
| $cat File | |
| \z No | |
| True at end of string only. | |
| \Z No | |
| True at end of string or before optional newline. | |
| $sed -e :a -e '$!N;s/\n[A-Z]//;ta' -e 'P;D' File |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #run task sequential | |
| time for i in `seq 1 5`;do sleep 1; done | |
| #run task in parallel | |
| time for i in `seq 1 5`;do sleep 1 & done ; wait | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Compare lines in the same file | |
| while read A | |
| do | |
| read B | |
| ((i+=2)) | |
| [ "$A" != "$B" ] && echo "$A == $B Lines $((i-1)) and $i are different" | |
| done < file1.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # simple cisco equipment - telnet client - required IpList and commands files | |
| echo "===============================" | |
| echo " Please enter you pass! " | |
| echo "===============================" | |
| read -s -p "password: " pw | |
| printf "%b" "\n" | |
| cmd=`cat commands` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # simple icmp loop | |
| while true | |
| do | |
| ping -w2 -s 1550 $1 > /dev/null | |
| if [ $? -ne 0 ]:then | |
| echo "--- icmp request failed -- $(date) ---" >> /var/log/icmp.log | |
| fi | |
| done < IPLIST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!perl | |
| # Tree (PERL) | |
| # ordering option -- Preorder - Inorder - Postorder | |
| $tree=["Root", ["Grandma",["Mam",["Me"],["Brother"]],["Dad",["test"]],],]; | |
| sub FamRec { | |
| my $Person=$_[0]; | |
| print "-".$$Person[0]."\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| searchfor="Hallo" # something to search for | |
| tempfile="search.log" # temporary logfile | |
| echo -n "Searching for $searchfor. " | |
| grep -rl $searchfor / 2>/dev/null 1>>$tempfile & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!perl | |
| # perl script.pl < file.txt | |
| use warnings; | |
| use strict; | |
| my %seen=(); | |
| while(<>) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!perl | |
| use warnings; | |
| use strict; | |
| $|++; | |
| use DDP; | |
| use LWP; |