Connect Juniper VPN from linux

You can use openconnect to connect to a Juniper VPN:

openconnect --juniper mivpn.es

It will parse the web and will ask you for user/password.

But sometimes this does not work, so you would have to login via web and then copy the cookie DSID:

openconnect --juniper -C "DSID=ab353bbbcd677e8adf5a2f335b6c77ac" mivpn.es

 

Advertisements

Remove line breaks in CSV

Problem:
You have a CSV lines with new line breaks and you need one line per entry.

Solution:

A simple solution could be:
sed ':a;N;$!ba;s/\r\n/ /g' myfile.csv > myfile_no_nline.csv
If the new lines inside the CSV body are Windows new lines (\r\n) and the CSV lines are UNIX (\n).

But normally you are not so lucky. So if your CSV new lines are between quotes (“) you can use the following command:
cat myfile.csv | gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' > myfile_no_nline.csv