New answers tagged

0

You need to have shntool and cuetools installed. Also install the tta encoder and decoder from http://www.etree.org/shnutils/shntool/. It needs to be compiled it with g++ and yasm. Same goes for .ape files, which are also often used instead of .tta. split and name .flac files: find . -name "*.cue" -execdir sh -c 'shnsplit -f "$1" -o flac -t "%n_%p-%t" ...


0

A shell-only alternative: process batches of COUNT files via "${@:START:COUNT}" (range of positional parameters) and shift COUNT while incrementing a counter c to name the archives: set -- * c=1 while (($#)); do if [ $# -ge COUNT ]; then zip ${c}.zip "${@:1:COUNT}" c=$((c+1)) shift COUNT else zip ${c}.zip "${@}" shift $# fi done


4

awk 'NR==1 {a=$0} (NR-1)%100==0 {print a > "d/file_" int(1+(NR-1)/100)} {print > "d/file_" int(1+(NR-1)/100)}'


3

Works for me in bash: lines=100; { read header && sed "1~$((${lines}-1)) s/^/${header}\n/g" | split -l $lines --numeric-suffixes=1 --additional-suffix=.txt - file_ ; } < inputfile.txt


2

IFS=. read -r first second third fourth fifth <<< "$var" This sets the field separator to "." then tells bash to read into the named variables from the input provided by your $var's contents.


4

With gnu split you could save the header in a variable then split starting from the 2nd line, using the --filter option to write the header first and then the 99 lines for each piece and also specify the output directory (e.g. path to/output dir/): header=$(head -n 1 infile.txt) export header tail -n +2 infile.txt | split -l 99 -d --additional-suffix=.txt \ ...


3

Parsing whitespace-delimited columns is something awk does well. canceljob $(showq | awk '$2 == "jquick" {print $1}') or more directly showq | awk '$2 == "jquick" {system("canceljob " + $1)}' Alternatively, pass a constraint to showq to make it report only the desired jobs. canceljob $(showq -w user=jquick)


3

try showq | awk '/jquick/ { printf "canceljob %d\n",$1}' if OK, pipe to bash, or showq | awk '/jquick/ { print $1}' | xargs canceljob


3

Lets take the first line: 124.115.5.11 - - [30/May/2011:23:21:37 -0500] "GET / HTTP/1.0" 200 206492 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322;TencentTraveler)" and the crucial part of the awk snippet: awk '{ split($4,array,"/") ... Here what is happening: awk runs and splits the line on the spaces (default field ...



Top 50 recent answers are included