Removing header and trailer row, removing field in csv file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
vsmeruga
Posts: 35
Joined: 04 Jun 2014 06:42

Re: Removing header and trailer row, removing field in csv f

#16 Post by vsmeruga » 07 Oct 2014 06:13


Perfect. It worked. I got the findrepl.bat from drop box

Many Many Thanks..
Perfect. It worked. I got the findrepl.bat from drop box

Many Many Thanks..

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Removing header and trailer row, removing field in csv f

#17 Post by Squashman » 07 Oct 2014 07:12

Why do you keep quoting yourself in all of your posts.

Quoting is for when you are using part of someone else post.

vsmeruga
Posts: 35
Joined: 04 Jun 2014 06:42

Re: Removing header and trailer row, removing field in csv f

#18 Post by vsmeruga » 07 Oct 2014 07:57

Understood about when to use quote Thanks.

I would like to understand this command what it is exactly doing?. for eg: In future, If I have to remove some other field instead of "ID" field

1.what does "o:2:-2" represent?. Is it same for what ever field I remove in the file?
2. *? - : this *? is in 4th position as I have to remove my 4th field ID .

your help understanding it is most appreciated.
Thanks

type "file.csv"|findrepl /o:2:-2 |findrepl "(.*?,.*?,.*?,).*?,(.*)" "$1$2"

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Removing header and trailer row, removing field in csv f

#19 Post by foxidrive » 07 Oct 2014 14:46

vsmeruga wrote:1.what does "o:2:-2" represent?


It filters the file and shows only from line 2 to the 2nd last line.

2. *? - : this *? is in 4th position as I have to remove my 4th field ID .


This uses regular expressions and it removes the text from after the third comma, until the 4th comma inclusive, in each line.

Post Reply