Posted on 05-14-2020 11:23 AM
Looking for advice on why this command would pull line endings from csv, any help appreciated.
awk -v var="INSERTSERIALHERE" -F',' '$0 ~ var {print $2}' /tmp/googleemail.csv
Posted on 05-14-2020 09:28 PM
Hi @chrisdaggett ,
Not 100% sure what you mean by line-ending, but if you are looking for the script to output a different column, you can adjust the print value:
#Pulls second value
{print $2}
To:
#Pulls first value
{print $1}
Also your field separator is set to a comma:
-F','
Which is standard for Comma Separate Values, but if there is unconditional formatting you may have to change it.
Feel free to add an example csv if you are still running into errors
Posted on 05-15-2020 04:22 AM
Well I was wrong, I thought it was pulling n/ because of the line endings, but I think it was because a few of the serial #'s were set to n/a (students who did not have a laptop). What I don't understand is why it started pulling the next line?
It is a 2 column CSV, pulling second value.
Example shared below, I have cleaned up the sheet it was pulling from originally to remove the "N/A" but still nervous to push this out again lol.