Search found 35 matches

by shaswat
05 Nov 2015 07:12
Forum: DOS Batch Forum
Topic: Changing date from MM/DD/YY to MM/DD/YYYY format
Replies: 4
Views: 6025

Changing date from MM/DD/YY to MM/DD/YYYY format

Hi Team, I have a requirement where I need to change the date format of the columns. Here I have provided my script, input file, output file and the desired output file. Please suggest the changes required in my script to get the desired output. Currently I am getting the output in the MM/DD/YY form...
by shaswat
04 Nov 2015 10:43
Forum: DOS Batch Forum
Topic: Find and Replace fields in a column of a CSV file
Replies: 7
Views: 9878

Re: Find and Replace fileds in a column of a CSV file

You are going to kick yourself for not seeing how obvious this is. setLocal EnableDelayedExpansion for /f "tokens=1-7 delims=|" %%a in ('parseCSV.bat "/o:|" ^<INPUT.csv') do ( Set str1=%%b set str1=!str1:SALE=SELL! set str1=!str1:PURCHASE=BUY! echo "%%~a",!str1!,"...
by shaswat
04 Nov 2015 07:19
Forum: DOS Batch Forum
Topic: Changing the date format in the columns of a CSV file
Replies: 16
Views: 11342

Re: Changing the date format in the columns of a CSV file

Dave Benham Thanks a lot for your help. With your help I could convert the D-Mon-YY ==> MM/DD/YY format. But currently in some of my requirement I need this as MM/DD/YYYY format. Is there any way that I can convert my MM/DD/YY to MM/DD/YYYY format. Or it will be nice if I can directly convert D-Mon...
by shaswat
04 Nov 2015 07:18
Forum: DOS Batch Forum
Topic: Find and Replace fields in a column of a CSV file
Replies: 7
Views: 9878

Re: Find and Replace fileds in a column of a CSV file

Why are you not using 7 tokens and a comma as the delimiter. Your examples shows that you are only changing those values in the 2nd field. So you should only be assigning the token %%b to an environmental variable and doing string replacement on that environmental variable. Then you will echo out a...
by shaswat
28 Oct 2015 03:27
Forum: DOS Batch Forum
Topic: Find and Replace fields in a column of a CSV file
Replies: 7
Views: 9878

Re: Find and Replace fileds in a column of a CSV file

Could you please post the code you have tried so far. Hi, Please find the code below and the resulted output. Please suggest the changes required in my code to get the desired output. Thanks..!! CODE: setLocal EnableDelayedExpansion For /f "tokens=1-2 delims= " %%a in (INPUT.csv) do ( Set...
by shaswat
27 Oct 2015 08:49
Forum: DOS Batch Forum
Topic: Find and Replace fields in a column of a CSV file
Replies: 7
Views: 9878

Find and Replace fields in a column of a CSV file

Hi Team, I have a requirement where I need to change some of the values of a column of a file. I want SALE to be changed as SELL and PURCHASE to be changed as BUY only in a specific column. Please find my input file and desired output file for clear understanding of my requirement. Please suggest me...
by shaswat
06 Oct 2015 06:22
Forum: DOS Batch Forum
Topic: Formatting a CSV file and sorting the values
Replies: 12
Views: 8737

Re: Formatting a CSV file and sorting the values

. http://www.dostips.com/forum/viewtopic.php?p=42985#p42985 Hi, I have tried by using the help of the script in the link, please find my script, input and output file. Script: @echo off setlocal enableDelayedExpansion :: Define LF to contain a linefeed (0x0A) character set ^"LF=^ ^" The e...
by shaswat
05 Oct 2015 11:23
Forum: DOS Batch Forum
Topic: Formatting a CSV file and sorting the values
Replies: 12
Views: 8737

Re: Formatting a CSV file and sorting the values

Since your new revised input data has spaces in it and is not surrounded by quotes, the existing code you are using is not going to work. Hi Squashman, I am currently modifying my script with the help of the link you have provided, but somehow I am still not getting the desired output. I'll do some...
by shaswat
05 Oct 2015 08:33
Forum: DOS Batch Forum
Topic: Formatting a CSV file and sorting the values
Replies: 12
Views: 8737

Re: Formatting a CSV file and sorting the values

This program fail if wildcard characters (asterisk or question-mark) are included in the fields. Also, it remove exclamation marks. Antonio Hi Antonio, Your code helped me a lot for resolving my issue, but currently I am facing some issue while the input file format is slightly changes. You can fin...
by shaswat
22 Sep 2015 13:24
Forum: DOS Batch Forum
Topic: Changing the date format in the columns of a CSV file
Replies: 16
Views: 11342

Re: Changing the date format in the columns of a CSV file

Look at my example. I have replaced the %line% with %%a and %%d for date1 and date2 respectively, but still the script is somehow not correct. Could you please let me know where I'm going wrong? @echo off setlocal EnableDelayedExpansion set m=100 for %%a in (Jan Feb Mar Apr May Jun Jul Aug Sep Oct ...
by shaswat
22 Sep 2015 13:01
Forum: DOS Batch Forum
Topic: Changing the date format in the columns of a CSV file
Replies: 16
Views: 11342

Re: Changing the date format in the columns of a CSV file

The above line of code will be used twice inside this FOR /F command. As per your suggestion I have done few changes but I think I'm wrong as the output I'm getting after executing the script is shown below: ",516121,PSAM,",O,Option,42655,"8/21/15 ",516121,PSAM,",CU,Currenc...
by shaswat
22 Sep 2015 11:06
Forum: DOS Batch Forum
Topic: Changing the date format in the columns of a CSV file
Replies: 16
Views: 11342

Re: Changing the date format in the columns of a CSV file

Post your code and we will guide you on what you are doing wrong. Hi, Please find the attached code, input file and the output file that i'm getting while executing the script. Script: @echo off setlocal EnableDelayedExpansion set m=100 for %%a in (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) d...
by shaswat
22 Sep 2015 10:22
Forum: DOS Batch Forum
Topic: Changing the date format in the columns of a CSV file
Replies: 16
Views: 11342

Re: Changing the date format in the columns of a CSV file

Antonio gave you the code to change the date format in your previous thread! http://www.dostips.com/forum/viewtopic.php?p=42984#p42984 You have been given several examples of all the commands you need to use in all your previous threads. Please make an attempt to solve it yourself. Hi Squashman, I ...
by shaswat
22 Sep 2015 09:12
Forum: DOS Batch Forum
Topic: Changing the date format in the columns of a CSV file
Replies: 16
Views: 11342

Changing the date format in the columns of a CSV file

Hi Team, I have a requirement where I need to change the date format of the columns. Here I have provided the input file and the desired output file. Please suggest me a script that will do this work. Input File: 17-Aug-15,516121,PSAM,14-Aug-15,O,Option,42655,8/21/15 21-Jan-11,516121,PSAM,17-Aug-15,...
by shaswat
22 Sep 2015 08:53
Forum: DOS Batch Forum
Topic: Adding value from the header of the file to the body
Replies: 9
Views: 6352

Re: Adding value from the header of the file to the body

I think those two examples should give you enough information to adjust the script according to the data. Hard to write anything more dynamic without really knowing what all the data actually looks like. Thanks a lot Squashman. Your inputs really helped me a lot. As per changed or different input f...