Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Sign In

Login to our social questions & Answers Engine to ask questions answer people's questions & connect with other people.

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

You must login to add post.

AWK command for all purpose

This is for tab-delimited CSV file where we have added header and filter the data like for 24th column should have 1000 value and 20th column should have less than value 2 and instead of column 1 displaying different data we display the static content which is “Test Col” and we added else condition too if we need to display the 2nd column different but static according to condition

awk ‘BEGIN {print “Name”, “Gender”, “Firstname”, “Lastname”, “Date Start”, “Date End”, “Duration in Sec”}1 {FS=”\t”}; {if ($24 == 1000 && $20 < 2 )print “Test Col”, “Dummy A”, $2, $3, $14, $16, $33 ; else if ($24 == 1000 && $20 > 1 )print “Test Col”, “Dummy B”, $2, $3, $14, $16, $33 ;}’ ori_file.csv >> mod_file.csv

admin

admin

Enlightened

I like to receive and deal with challenging tasks. I am a very enthusiastic person and I think this is a strong point of mine. My friends say that I am a very funny with a good sense of humor. As soon as I meet new people who are happy to meet me, I feel extremely comfortable with them.

Leave a comment

You must login to add a new comment.