31 votes

Is it possible to implement a "name" booking system using linux file permissions

What you ask for the directory /reservations is exactly how the standard /tmp directory behaves: Every user can create files in there and only he is allowed to delete or modify them. This is achieved ...
PerlDuck's user avatar
  • 13.3k
19 votes
Accepted

How do I carry my variables from a Bash script into a Perl one?

Making variables available to child process in shell script can be done either by exporting variables export foo=bar Or by calling program with variables prepended foo=bar ./my_prog.pl In either ...
Sergiy Kolodyazhnyy's user avatar
17 votes
Accepted

How can I change ^L code in many files in Ubuntu?

Control-L (represented as ^L) is the "form feed" character. In ASCII, it has decimal value 12 (L is the 12th letter of the alphabet) or hex value 0c: $ printf 'foo\x0cbar\n' | cat -et foo^Lbar$ $ ...
steeldriver's user avatar
16 votes

How do I install asciiquarium?

No compiling is required as there is a PPA that I believe is run by a Debian developer dedicated solely to asciiquarium. Open a Terminal window and paste the following two commands: sudo add-apt-...
andrew.46's user avatar
  • 38.1k
12 votes

Unable to find ack in Ubuntu 17.10 repositories

Ack has a test failure in Ubuntu 17.10 Artful and it has been excluded from Ubuntu until it passes. Perl is upgraded on Artful and the old ack version isn't supported by the new Perl. The new version ...
Stephen Ostermiller's user avatar
11 votes
Accepted

How do I install asciiquarium?

These instructions will work for Ubuntu 12.04 and later. Install term-animation First, you need to install Perl module called term-animation. Open a command-line terminal by pressing CTRL+ALT+T. ...
Curtice Gough's user avatar
10 votes
Accepted

Ubuntu 15.10 Installing SDL2

Easiest way is to just install by apt-get... If you just want the libraries: sudo apt-get install libsdl2-2.0 On Bionic or newer: sudo apt-get install libsdl2-2.0-0 If you want to do development:...
RandomUser762's user avatar
10 votes
Accepted

What's the difference between the different "rename" commands?

How come there are two packages providing different commands using the same name (if not by accident)? That's not unusual. Authors typically pick the simplest command name they think of, so if two ...
muru's user avatar
  • 198k
10 votes

How do I carry my variables from a Bash script into a Perl one?

Using the environment is a cleaner way. There is the -s switch: $ cat vars.pl #!perl use feature 'say'; say "foo=$foo"; say "bar=$bar"; $ echo "$foo,$bar" 123,456 $ perl -s ./vars.pl -foo="$foo" ...
glenn jackman's user avatar
9 votes

Trying to update from 16.04LTS to 18.04LTS but unmet perl dependencies or conflicts when updating packages

@user535733: you're the man! it helped. To be precise: you can't remove virtual package (which perl-modules are) - instead: apt remove perl-modules-5.22 In my case.
TEAR DOWN's user avatar
8 votes

Cannot load cgi-library into perl-cgi-script

Partially answering this for my own archiving. This seems to be a recent error that stems from a broken dependency. I got a similar error message when check the error log. tail -100 /var/log/apache2/...
AlaskaJoslin's user avatar
8 votes

How to replace the content to multiple files?

With awk you can just use | as column separator and print the first column: awk -F '|' '{print $1}' file1.txt file2.txt file3.txt output will be concatenaded. If it's necessary to keep output in ...
Sergiy Kolodyazhnyy's user avatar
7 votes
Accepted

process over records of files based on timestamp in x interval of the time

Writing reports on time stamped datafiles; complex requirements While the original question was a bit complicated, the context of the question made it a quite difficult one. Additional circumstances ...
Jacob Vlijm's user avatar
  • 83.8k
7 votes
Accepted

Deleted /usr/share/perl/5.26 because I had /usr/share/perl/5.26.1 folder

You have to simply use the power of APT to restore folder contents: sudo apt-get install --reinstall \ $(dpkg -S /usr/share/perl/5.26 | sed "s/,//g" | sed "s|: /usr/share/perl/5.26||&...
N0rbert's user avatar
  • 100k
7 votes
Accepted

bash --> perl command: print only the replaced text

The -p argument is like sed's default print - also like sed, if you want to suppress default print, you would use -n instead. So you could do perl -ne "print if s/^Val2 = '(.*)'/\1/" test....
steeldriver's user avatar
6 votes
Accepted

How to compare 2 files and extract the particular sequence using ID in first file and print the out put

You could write a script to do this directly, but I suggest you use the two little scripts below instead. I have spent many years working with this sort of data and they have been very, very useful. ...
terdon's user avatar
  • 101k
6 votes

Unable to find ack in Ubuntu 17.10 repositories

Sadly ack is not in 17.10 repositories. A workaround is to install it manually as per the instructions on its website. Here's what I did: $ sudo su # curl https://beyondgrep.com/ack-2.18-single-file ...
Pēteris Caune's user avatar
6 votes

Deleted /usr/share/perl/5.26 because I had /usr/share/perl/5.26.1 folder

Many programs/libraries use symlinks to abstract away the exact version numbers and present a more stable location. For instance, rarely do programs care that your Perl patch number is 5.26.1 but may ...
Brian Turek's user avatar
  • 1,826
6 votes

bash perl \z doesn't work

The command line option -p means that the file is processed line by line, i.e. what you do is basically: while (<>) { s/text2\n\z/text3/s; print $_ } Therefore the \z does not match ...
Steffen Ullrich's user avatar
5 votes
Accepted

Perl Cannot Find Module XML/Simple

All of the Simple.pm files you've found belong to other Perl libraries. None of them do what you want. You have found IPC::System::Simple Lintian::Command::Simple Log::Message::Simple Locale::...
waltinator's user avatar
  • 36.5k
5 votes
Accepted

adding zero to specific location of file names

Use this command rename -n -v 's/(.{4})(.*)/${1}0${2}/' * See if the result is what you want, remove -n and -v options. Explanation: take this simple command: rename 's/pattern/result/' filename(...
Mostafa Ahangarha's user avatar
5 votes

Vim refuses to start with "error while loading shared libraries: libperl.so.5.14" after upgrade to Ubuntu 14.04

Just create a shortcut: ln -s /usr/lib/x86_64-linux-gnu/libperl.so.5.20 /usr/lib/x86_64-linux-gnu/libperl.so.5.14  
Miguelinni's user avatar
5 votes

echo first group in perl

Turn Perl's autosplit on. It splits the lines into the array @F (on whitespace), so $F[0] contains the first column. ps -ejH | perl -a -E 'if (/bash/) {say $F[0]; last;}' You can also get rid of the ...
PerlDuck's user avatar
  • 13.3k
5 votes

Add minutes to date time column

I'm assuming that the last field should be interpreted in the same fashion as the penultimate one i.e. 340 means an offset of 3 hours and 40 minutes. If that is correct, then using GNU awk's Time ...
steeldriver's user avatar
5 votes

Renaming multiple files by removing a single number (1 & 2) in each file

You can use mmv (install it with sudo apt install mmv) as follows: mmv -n 'paired_dat_*2_R2*' 'paired_dat_#1\1_R2#2' -n is used so that you can preview the changes without applying them to your files....
BeastOfCaerbannog's user avatar
4 votes

Perl .pl file downloads instead of being executed

Waking the dead but with the answer. Do this: ln -s /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/ ln -s /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/ sudo ...
Hans Olo's user avatar
4 votes
Accepted

How to run a perl script with arguments

-- is commonly used to indicate end of options, in this case perl -- file.pl -ARGUMENT This is explained in the documentation A -- signals the end of options and disables further option ...
J.J. Hakala's user avatar
4 votes
Accepted

How to ignore multiple files and directories with grive?

Ignoring multiple directories can be done by using positive lookahead. This regex ignores the directories "irrelevant" and "unnecessary": grive --ignore '(?=^irrelevant$)|(?=^unnecessary$)' The dry-...
Florian-g's user avatar
4 votes

I have a file. I need to print all the quantities with unique values no duplicates, using perl

Since you tagged your question perl, how about using a perl hash? $ perl -ne '/[,|](38=\d+)/ ; print unless $seen{ $1 }++' file Order:167342,9=205|21=1|553=2453|49=11342|56=MBT|10=085|55=/GCQ3|1=...
steeldriver's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible