Sed one liners for Webex

Published: Jun 30, 2026, last updated: Jul 2, 2026
Reading time: 1 min

I recently came across a customer with nearly a thousand speed dials in a CSV document. In a similar (but significantly better) vein to my earlier post regarding this, here are the one liners I used to get this working:

  • Append +44 country to the start of every line:
    sed -i 's/^/+44/' numbers.txt

  • Replace leading 0 with +44 on every line:
    sed -i 's/^0/+44/' numbers.txt

  • Paste together names, numbers and number type into a new CSV document:
    paste names.txt numbers.txt | awk -F'\t' 'BEGIN{OFS=","} {print $1,"","",$2,"work"}' > contacts.csv

  • Add webex contact header to newly created CSV document:
    sed -i '1iDisplay Name,First Name,Last Name,Phone Number 1,Phone Number 1 Type,Phone Number 2,Phone Number 2 Type,Phone Number 3,Phone Number 3 Type,Phone Number 4,Phone Number 4 Type,Phone Number 5,Phone Number 5 Type,Contact Email,SIP URI,Title,Company Name,Address Street,Address City,Address State,Address Country,Address Zip,Group ID 1,Group ID 2,Group ID 3,Group ID 4,Group ID 5' document.csv

  • Remove all whitespace before comma delimiters:
    sed -i 's/ *,/,/g' contacts.csv

  • Remove identical duplicates:
    awk 'NR==1 || !seen[$0]++' contacts.csv > contacts_unique.csv

  • Move remaining name duplicates names to a second file to deal with later:
    awk -F, 'BEGIN{OFS=","} NR==1 {print > "contacts_dedup.csv"; print > "duplicates.csv"; next} !seen[$1]++ {print > "contacts_dedup.csv"; next} {print > "duplicates.csv"}' contacts.csv

  • Print duplicated numbers:
    awk -F',' '++count[$5] == 2 { print $5 }'