I have the following CSV file (it is comma separated file)
01/04/2022,02/04/2022,UPI/45/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
01/04/2022,02/04/2022,UPI/234234325435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
01/04/2022,02/04/2022,UPI/45435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
01/04/2022,02/04/2022,UPI/435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
01/04/2022,02/04/2022,UPI/435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
01/04/2022,02/04/2022,UPI/234234325435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
02/04/2022,02/04/2022,UPI/4545/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
03/04/2022,04/04/2022,UPI/234234325435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/04/2022,04/04/2022,UPI/67657/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
05/04/2022,05/04/2022,UPI/787/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
06/04/2022,06/04/2022,UPI/7878/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
I have to swap the days and months in the first and second column. I can use sed command. Using comma , instead of / to abstain escaping
$ sed -E 's,^([0-9]+)/([0-9]+),\2/\1,'
$ echo 01/04/2022 | cut -d, -f2 | sed -E 's,^([0-9]+)/([0-9]+),\2/\1,'
04/01/2022
However, I couldn't incorporate sed with CSV file, how can I do this? The resultant data must look like this
04/01/2022,04/02/2022,UPI/45/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/01/2022,04/02/2022,UPI/234234325435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/01/2022,04/02/2022,UPI/45435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/01/2022,04/02/2022,UPI/435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/01/2022,04/02/2022,UPI/435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/01/2022,04/02/2022,UPI/234234325435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/02/2022,04/02/2022,UPI/4545/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/03/2022,04/04/2022,UPI/234234325435/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/04/2022,04/04/2022,UPI/67657/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/05/2022,04/05/2022,UPI/787/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08
04/06/2022,04/06/2022,UPI/7878/Upi Transaction/dsf.payu@hdfcban/HDFC BANK LTD/HDF1EEB5FACE82A4,5998.00,0.0,114362.08