用于删除文本文件中的连续文本行的批处理文件

时间:2012-03-15 16:04:52

标签: batch-processing batch-file

感谢您提供给我的任何帮助。我需要一个可以从文本文件中删除行的批处理文件,每行以时间开头,我需要在凌晨5:00到11:00之间删除所有内容,这样我就可以自动编辑文件。请温柔地对待我,因为我是批处理文件的新手;)

以下是文本文件的摘录:

"04:52:46","","T03","DA3072","UNDER THE BRIDGE","RED HOT CHILI PEPPERS","04:22","00","","","","","","","","",""
"04:57:08","","TPR","VO0502","PROMOTION ROTATOR #5","","00:30","00","","","","","","","","",""
"04:47:00",".","COM","DALIVE",":47 $TOP$ET HOLDER","","04:00","00","","",":47 Stopset Holder","","","","","",""
"04:61:38","","TLN","VO0004","LEGAL ID # 4","","00:11","00","","","","","","","","",""
"04:61:49","","T00","DA0195","ALL ALONG THE WATCHTOWER","JIMI HENDRIX","03:51","00","","","","","","","","",""
"04:65:40","","T01","DA0795","HEY HEY MY MY (INTO THE BLACK)","NEIL YOUNG","05:01","00","","","","","","","","",""
"04:70:41","","TLN","VO6010","SHORT SWEEPER ROTATOR 5","","00:04","00","","","","","","","","",""
"04:70:45","","T00","DA0081","BURNING DOWN THE HOUSE","TALKING HEADS","03:44","00","","","","","","","","",""
"05:00:01","*","","","TOP HOUR SOFT SYNC","","00:00","00","","","TOP HOUR SOFT SYNC","","","","","",""
"05:00:00","","TLN","VO6006","SHORT SWEEPER ROTATOR 1","","00:04","00","","","","","","","","",""
"05:00:04","","T02","DA0916","THE HAPPIEST DAYS OF OUR LIVES / ANOTHER BRICK I","PINK FLOYD","05:38","00","","","","","","","","",""
"05:05:42","","T01","DA0496","TAKE THE LONG WAY HOME","SUPERTRAMP","04:42","00","","","","","","","","",""
"05:10:24","","TLN","VO6001","LONG SWEEPER ROTATOR 2","","00:08","00","","","","","","","","",""
"05:10:32","","T02","DA1004","I CAN'T DANCE","GENESIS","03:52","00","","","","","","","","",""
"05:14:24","","TLN","VO6009","SHORT SWEEPER ROTATOR 4","","00:04","00","","","","","","","","",""
"05:14:28","","T01","DA0790","DANCING DAYS","LED ZEPPELIN","03:39","00","","","","","","","","",""
"05:15:01","*","","",":15 SOFT SYNCH","","00:00","00","","","","","","","","",""
"05:18:07","","TLN","VO4013","ZZ TOP ROTATOR","","00:29","00","","","","","","","","",""
"05:18:36","","T01","DA0471","TUSH","ZZ TOP","02:12","00","","","","","","","","",""
"05:20:48","","TPR","VO0500","WEBSITE ROTATOR","","00:25","00","","","","","","","","",""
"05:17:00",".","COM","DALIVE",":17 $STOP$SET HOLDER","","04:00","00","","",":17 Stopset Holder","","","","","",""
"05:25:13","","TLN","VO6011","SHORT SWEEPER ROTATOR 6","","00:04","00","","","","","","","","",""
"05:25:17","","T00","DA0371","EVERY BREATH YOU TAKE","POLICE","03:58","00","","","","","","","","",""
"05:29:15","","T01","DA0806","IN THE CITY","EAGLES","03:37","00","","","","","","","","",""
"05:32:52","","TLN","VO6010","SHORT SWEEPER ROTATOR 5","","00:04","00","","","","","","","","",""
"05:32:56","","T00","DA0231","WHAT'S YOUR NAME","LYNYRD SKYNYRD","03:28","00","","","","","","","","",""
"05:30:05","*","","","Walton 5:30 Soft Synch","","00:00","00","","","Walton and Johnson","","","","","",""
"10:00:00","","T00","DA0388","LOVE BITES","DEF LEPPARD","05:31","00","","","","","","","","",""
"10:05:31","","T01","DA0459","THE GRAND ILLUSION","STYX","04:27","00","","","","","","","","",""
"10:00:01","*","","","TOP HOUR SOFT SYNC","","00:00","00","","","TOP HOUR SOFT SYNC","","","","","",""
"10:09:58","","TLN","VO6008","SHORT SWEEPER ROTATOR 3","","00:04","00","","","","","","","","",""
"10:10:02","","T03","DA3010","SMOKE ON THE WATER","DEEP PURPLE","07:07","74","C","","","","","","","",""
"10:17:09","","T01","DA0517","MISS YOU","ROLLING STONES","04:40","00","","","","","","","","",""
"10:21:49","","VTK","JBTIME","VOICETRACK JOIN BOTH","","00:30","00","","","Voicetrack JB Time","","","","","",""
"10:22:19","","T00","DA0038","TAKIN' IT TO THE STREETS","DOOBIE BROTHERS","03:29","00","","","","","","","","",""
"10:25:48","","TLN","VO6009","SHORT SWEEPER ROTATOR 4","","00:04","00","","","","","","","","",""
"10:25:52","","T01","DA0710","HIGHWAY TO HELL","AC/DC","03:27","00","","","","","","","","",""
"10:29:19","","VTK","JUTIME","VOICETRACK JOIN UP","","00:30","00","","","Voicetrack JU Time","","","","","",""
"10:29:49","","TPR","VO0024","PROMOTION ROTATOR #1","","00:34","00","","","","","","","","",""
"10:17:00",".","COM","DALIVE",":17 $STOP$SET HOLDER","","04:00","00","","",":17 Stopset Holder","","","","","",""
"10:34:23","","TLN","VO6011","SHORT SWEEPER ROTATOR 6","","00:04","00","","","","","","","","",""
"10:34:27","","T02","DA1155","NEW YEARS DAY","U2","05:28","00","","","","","","","","",""
"10:39:55","","T03","DA3050","EPIC","FAITH NO MORE","04:49","00","","","","","","","","",""
"10:30:00","*","","","BOTTOM HOUR SOFT SYNC","","00:00","00","","","BOTTOM HOUR SOFT SYNC","","","","","",""
"10:44:44","","TLN","VO6010","SHORT SWEEPER ROTATOR 5","","00:04","00","","","","","","","","",""
"10:44:48","","T01","DA0756","MAGIC CARPET RIDE","STEPPENWOLF","04:11","00","","","","","","","","",""
"10:48:59","","VTK","JUTIME","VOICETRACK JOIN UP","","00:30","00","","","Voicetrack JU Time","","","","","",""
"10:49:29","","TPR","VO0394","PROMOTION ROTATOR #3","","00:27","00","","","","","","","","",""
"10:34:00",".","COM","DALIVE",":34 $TOP$SET HOLDER","","04:00","00","","",":34 Stopset Holder","","","","","",""
"10:53:56","","TLN","VO6007","SHORT SWEEPER ROTATOR 2","","00:04","00","","","","","","","","",""
"10:54:00","","T00","DA0347","RHIANNON (WILL YOU EVER WIN)","FLEETWOOD MAC","04:01","00","","","","","","","","",""
"10:58:01","","TLN","VO6005","LONG SWEEPER ROTATOR 6","","00:08","00","","","","","","","","",""
"10:58:09","","T00","DA0253","ROXANNE","POLICE","02:59","00","","","","","","","","",""
"10:45:00","*","","",":45 SOFT TIME","","00:00","00","","","","","","","","",""
"10:61:08","","T03","DA3089","INTERSTATE LOVE SONG","STONE TEMPLE PILOTS","03:07","00","","","","","","","","",""
"10:64:15","","VTK","JUTIME","VOICETRACK JOIN UP","","00:30","00","","","Voicetrack JU Time","","","","","",""
"10:47:00",".","COM","DALIVE",":47 $TOP$ET HOLDER","","04:00","00","","",":47 Stopset Holder","","","","","",""
"10:68:45","","TLN","VO2006","LEGAL ID # 4","","00:11","00","","","","","","","","",""
"10:68:56","","T01","DA0624","DREAM ON","AEROSMITH","04:20","00","","","","","","","","",""
"10:73:16","","T00","DA0136","CROSSROADS","CREAM","04:08","00","","","","","","","","",""
"11:00:01","*","","","TOP HOUR SOFT SYNC","","00:00","00","","","TOP HOUR SOFT SYNC","","","","","",""
"11:00:00","","TLN","VO6008","SHORT SWEEPER ROTATOR 3","","00:04","00","","","","","","","","",""
"11:00:04","","T01","DA0835","PRIDE AND JOY","STEVIE RAY VAUGHAN","03:36","00","","","","","","","","",""
"11:03:40","","T03","DA1629","WE'RE NOT GONNA TAKE IT","TWISTED SISTER","03:28","00","","","","","","","","",""
"11:07:08","","VTK","JBTIME","VOICETRACK JOIN BOTH","","00:30","00","","","Voicetrack JB Time","","","","","",""

正如你所看到的,这些行以时间开头,所以我认为它不会太难,但我需要它在凌晨5点到11点之间取出所有内容,然后在没有这些时间的情况下保存文本文件。 / p>

再次感谢!

1 个答案:

答案 0 :(得分:2)

格雷格说他想出了答案,但他没有发布。所以这是一个使用FINDSTR和正则表达式的简单解决方案。该脚本期望将文件的名称作为第一个(也是唯一的)参数进行处理。

@echo off
findstr /vrb /c:"\"0[56789]:^" /c:"\"10:^" "%~1" >"%~1.mod"
move /y "%~1.mod" "%~1"