1

I have below file content from which I want to remove double quotes " and dot .:

Password expiration notice for beems Server
# cat pschagKK
Password expiration notice for "beems" Server.example.com
Password expiration notice for "beems" Server.example.com
Password expiration notice for "beems" Server.example.com
Password expiration notice for "goog_dev" Server.example.com
Password expiration notice for "goog_integ" Server.example.com
Password expiration notice for "noodle" Server.example.com
Password expiration notice for "noodle" Server.example.com
Password expiration notice for "pacct" Server.example.com
Password expiration notice for "pacct" Server.example.com
Password expiration notice for "pacct" Server.example.com
Password expiration notice for "pacct" Server.example.com
Password expiration notice for "pacct" Server.example.com

I am trying sed but unable to find a way to remove dots as well:

# cat pschagKK | sed 's/"/ /g'
Password expiration notice for  beems  Server.example.com
Password expiration notice for  beems  Server.example.com
  • awk '{gsub(/"|\./,"")}1' file – jasonwryan Nov 13 '15 at 6:55
3

One way with sed:

sed -e 's/[".]//g' <file
| improve this answer | |
  • My bad i just forgot to add , i want to remove dot and everything after string "server". – Rocky Nov 13 '15 at 7:04
  • Rest your code working like a charm Cuonglm – Rocky Nov 13 '15 at 7:05
  • For Now i thoght tohave below solution , at least they are space separated now.. # sed -e 's/[".]/ /g' pschagKK Password expiration notice for beems Server example com Password expiration notice for beems Server example com Password expiration notice for beems Server example com – Rocky Nov 13 '15 at 7:13
  • cuong, +1..just curious.. is -e needed here? is it doing anything? – heemayl Nov 13 '15 at 8:07
  • @heemayl: No, -e is not required here. – cuonglm Nov 13 '15 at 8:35
2

Another way (and less typing) is tr:

tr -d '".' < file
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.