Tag Info

Hot answers tagged

5

Change this: find ./ -newerct '1 week ago' -print | grep TODO to this: find ./ -newerct '1 week ago' -exec grep TODO {} + or this: find ./ -newerct '1 week ago' -print | xargs grep TODO Explanation Your grep doesn't interpret the output of find as a list of files to search through, but rather as its input. That is, grep tries to match TODO in the ...


3

Just install the missing module in the standard way. cpan Shell


3

On a RPM based system: $ repoquery -l perl-ExtUtils-Embed lists the files in the package: /usr/share/man/man3/ExtUtils::Embed.3pm.gz /usr/share/perl5/ExtUtils/Embed.pm Therefore, you're looking for Embed.pm. On Ubuntu (which I believe is close enough to Debian in this case): $ apt-file search Embed.pm searches for a packages that provides the given ...


2

rename works this way because it can move files between directories. Like mv, it acts on the whole path, not just on the last component. If you only want to modify the last component, you can anchor your regexp at (\A|?<=/), and make sure that it doesn't match any / and only matches at the last /. rename 's~(\A|?<=/)(?=[^/]*)\z~assi_~' ...


2

Found something here: Stackoverflow - Convert from unixtime at command line. Came up with this: awk -F"," '{OFS=","; $1=strftime("%Y-%m-%d %H:%M:%S", $1); print $0}' file -F"," to use a field separator of ,, OFS=","; so that the output fields are also separated by a ,, $1=strftime("%Y-%m-%d %H:%M:%S", $1); to change the value of the first field $1 into ...


2

To plagiarize myself, you can set up a profile with your desired settings (instructions adapted from here): Run terminator, and set up the layout you want. You can use Ctrl+Shift+E to split windows vertically and Ctrl+Shift+O (that's O as in oodles, not zero) to split horizontally. For this example, I have created a layout with 6 panes: Right click on ...


1

If you like awk you can use external command date with any date formats awk -F, -v OFS="," '{("date +%F\ %T -d @"$1)|getline $1}1'


1

Like this perhaps perl -pe 'use POSIX qw(strftime); s/^(\d+)/strftime "%F %H:%M:%S", localtime($1)/e'


1

Here's what you could do in plain bash, assuming the data is exactly as you posted. (Warning: modifies the files inplace. Be careful to take backups before testing.) A couple of functions to manage the first two files: next_id() { file="$1" # assumes file is sorted by id echo $(( $(tail -n 1 file|cut -d, -f1) + 1 )) } Assuming file1 and file2 are ...


1

Awk solutions (many assotiative arrays) but: #!/usr/bin/awk BEGIN { SUBSEP=" " split("A1^B2^C3^D4^E5",c,"^") } NR != 1 { L[$1]=1 G[$2]=1 a[$1,$2]=a[$1,$2]" "$3 b[$1,$2]=b[$1,$2]" "$4 } END { for (g in G) { i=1 for (l in L) { idx=b[l,g] if(d[idx]=="") d[idx]=c[i++] } } for (k in a) print k a[k] b[k],d[b[k]] } And do the ...


1

Not as easy as it seems. Perl solution, I tried to be a bit more verbose to make the code understandable. Basic knowldedge of nested data structures (hashes of hashes, hashes of arrays) is needed. #!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my (%collapsed, %groups); <>; # Skip header. while (<>) { my ($line, $group, ...



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