Tag Info

New answers tagged


I think a big part of the problem here is ... -k 1 ... sort's -key arguments imply at least a -k [num] start and ,[num] end reference for each. To say -k 1 is effectively no different than specifying no sort key at all because without an end reference sort will sort lines from the start of the line to its end. If you wanted to sort lines on only the ...


First, read the header from one of the files. Then read the data from both and sort: head -n 1 sample1.csv > results.csv && tail -q -n +2 sample1.csv sample2.csv | sort -t "|" -k 1 >> results.csv


This should work and output to data2.csv: head -n 1 data1.csv > data2.csv && tail -n +2 data1.csv | sort -t "|" -k 1 >> data2.csv


If you want to save foldename as csv file use this command: ~/test$ ls -d */|tr -d '/'| paste -sd , > outfile.csv dir1,dir2,dir3 ls -d */: list all directory names in current directory(in my case current directory is /home/KasiyA/test/). tr -d '/': removes / at the end of each name of directories. paste -sd ,: paste the result of previous tr command ...


Try this: ls -ld */ | awk -v OFS="," 'NR>1{print $3,$4,$5,$6" "$7,$8,$9}' > output.csv Include only the column numbers you want in the {print .....} block. EDIT: Play around with the coloumn numbers to arrange the coloumns in the order you wish to.


If you want folder names, do: find . -maxdepth 1 -mindepth 1 -type d -printf '%P,' | sed 's/,$/\n/' > output.csv Parsing the output of ls is bad idea. find can be used in combination with other tools to emulate the output of ls in many cases, and is a better tool for the job. -maxdepth 1, -mindepth 1: find will usually recursively search inside any ...


I doubt there is an auto-magical tool out there that receives a csv file as its input and then creates a report as an output -without- further interaction from the user... at least, you will be prompted to define the output layout, probably through the edition of some formatting/rules files. That being said, I think you may want to use something to go from ...

Top 50 recent answers are included