When work needs to be converted by the type encountered date or time type of data format, the question is as follows:
file1.txt file date data type there several columns, as follows
1999/03/25
2000/04/01
2008/05/28
To date data format now file1.txt file into the following form
1999-03-25
2000-04-01
2008-05-28
Now, respectively, to achieve this conversion with sed and awk commands in linux
1. Use sed command
sed "s/\/-/g" file1.txt > file2.txt
2. Use the awk command
awk -F"/" '{OFS="-";print $1,$2,$3}' > file2.txt
Use two commands are very easy to implement this conversion, but sed looks more professional and concise.
Powerful bar, pro!