awk -F, '{OFS="\t";print $3,$4}' mo_orders_weekly_2019-04-27.txt ==> awk '{print $4","$5}' mo_orders_weekly_2019-04-27.txt
cat mo_orders_weekly_2019-04-27.txt | cut -d ',' -f3 ==> cat mo_orders_weekly_2019-04-27.txt | cut -f3-4
awk -F, '{OFS=",";print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$20,$21}' infile.csv > outfile.csv
something else to consider - and this faster and more concise:
cut -d "," -f1-10,20-25,30-33 infile.csv > outfile.csv
Reference
- graph link
- How to concatenate multiple column values into a single column in Panda dataframe
- how do I insert a column at a specific column index in pandas?
- What is the 'cls' variable used for in Python classes?
- Bash - how to run a command after the previous finished?
- generate CSV file using AWK script
- Printing column separated by comma using Awk command line
-
Check existence of input argument in a Bash shell script
bash if [ $# -eq 0 ] then echo "No arguments supplied" fi
The$#
variable will tell you the number of input arguments the script was passed.Or you can check if an argument is an empty string or not like:
bash if [ -z "$1" ] then echo "No argument supplied" fi
The-z
switch will test if the expansion of "$1" is a null string or not. If it is a null string then the body is executed. -
Crontab - Run in directory
bash cd /path/to/directory && ./bin/myapp
Concerning the use of&&
instead of;
: normally it doesn't make a difference, but if the cd command fails (e.g. because the directory doesn't exist) with&&
the application isn't executed, whereas with;
it's executed (but not in the intended directory). - Python Execute Unix / Linux Command Examples
-
Python: executing shell script with arguments(variable), but argument is not read in shell script
python Process=Popen('./childdir/execute.sh %s %s' % (str(var1),str(var2),), shell=True)
-
wait process until all subprocess finish? [duplicate]
python exit_codes = [p.wait() for p in p1, p2]
-
How to import the class within the same directory or sub directory?
- Extract specific columns from delimited file using Awk
- How to split a string in bash delimited by tab