2017-09-16 123 views
-5

例如删除所有日期我想从所有行

04/06/2017, 6:48:03 PM: hey 
04/06/2017, 6:48:19 PM: hello 
04/06/2017, 9:04:29 PM: whats up 
04/06/2017, 9:54:57 PM: nothing much 
04/06/2017, 11:19:23 PM: yeah 
13/07/2017, 10:33:24 PM: because im kinda bored right now 
13/07/2017, 10:41:08 PM: no really? 
13/07/2017, 10:55:22 PM: fuck yes 
23/07/2017, 4:36:17 AM: do you want to accept jesus christ as your god? 
23/07/2017, 4:36:32 AM: sure give me Rope to tie it for you >:) 

我要删除的日期和时间,它的自我,我有超过1K行所以是那里有很多的日期和时间之间diffrences的,怎么可能我清除所有的日期和时间,并留下文字它的自我

hey 
hello 
whats up 
nothing much 
yeah 
because im kinda bored right now 
no really? 
fuck yes 
do you want to accept jesus christ as your god? 
sure give me Rope to tie it for you >:) 

这个

+3

加你尝试过什么。 –

+0

有人希望在发布问题之前尝试尝试。另外,使用更中性和专业的示例文本文件肯定不会太麻烦? – halfer

回答

-1

使用记事本++

  • 按Ctrl + H^
  • 查找内容:^\d{2}/\d{2}/\d{4}, \d{1,2}:\d{2}:\d{2} [AP]M:\h+
  • 替换:LEAVE EMPTY
  • 更换所有

说明:

^   : start of line 
\d{2}  : 2 digits 
/   : a slash 
\d{2}  : 2 digits 
/   : a slash 
\d{4}  : 4 digits 
,   : a comma 
\d{1,2}  : 1 or 2 digits 
:   : colon 
\d{2}  : 2 digits 
:   : colon 
\d{2}  : 2 digits 
[AP]M:  : A or P followed by M and a colon 
\h+   : 1 or more horizontal space 
  • 检查线上缠绕
  • 检查正则表达式

结果为给定的例子:

hey 
hello 
whats up 
nothing much 
yeah 
because im kinda bored right now 
no really? 
fuck yes 
do you want to accept jesus christ as your god? 
sure give me Rope to tie it for you >:) 
+0

它没有为我工作:c –

+0

最新的一个,但我需要命令将其全部删除,我像begginer对不起:c –

+0

感谢匿名序列downvoter。 – Toto

-2

不知道这是否帮助,但假设你可以输出这个数据到一个.csv(假设起诉到记事本标记)文件,然后我会咀嚼在excel中打开它并删除该行并将其导回。

+0

它不起作用 – iamsankalp89

0

使用冒号作为字段分隔符,打印从4场

cut -d : -f 4- file