Corresponding windows cmd command for unix command -


i using following unix command on mac separate out columns in file:

cut -d ' ' -f 3,4,5,10,11,12 < testfile.txt 

file sample:

unzip trace file: archive:  /logs/1.trace/instrument_data/2dfbb7cf-2b32-41d6-9fa6-73cf813dfc24/run_data/1.run.zip   inflating: logs/2.trace/instrument_data/2dfbb7cf-2b32-41d6-9fa6-73cf813dfc24/run_data/1.run     run 1, starting @ 2015/08/06 16:46:35:185, running until 2015/08/06 16:53:30:445 sample 0: cpu usage: 2.56% memory usage: 5608.00 kib timestamp: 2015/08/06 16:46:35:955  sample 1: cpu usage: 1.21% memory usage: 5576.00 kib timestamp: 2015/08/06 16:46:37:143  sample 2: cpu usage: 2.46% memory usage: 5560.00 kib timestamp: 2015/08/06 16:46:38:323  sample 3: cpu usage: 2.49% memory usage: 5560.00 kib timestamp: 2015/08/06 16:46:39:502  sample 4: cpu usage: 2.51% memory usage: 5560.00 kib timestamp: 2015/08/06 16:46:40:674  sample 5: cpu usage: 2.56% memory usage: 5560.00 kib timestamp: 2015/08/06 16:46:41:832  sample 6: cpu usage: 2.21% memory usage: 5560.00 kib timestamp: 2015/08/06 16:46:43:009  sample 7: cpu usage: 1.92% memory usage: 5560.00 kib timestamp: 2015/08/06 16:46:44:202  sample 8: cpu usage: 2.83% memory usage: 5572.00 kib timestamp: 2015/08/06 16:46:45:408  

also below data junk me, need remove it

unzip trace file:     archive:  /logs/1.trace/instrument_data/2dfbb7cf-2b32-41d6-9fa6-73cf813dfc24/run_data/1.run.zip       inflating: logs/2.trace/instrument_data/2dfbb7cf-2b32-41d6-9fa6-73cf813dfc24/run_data/1.run 

what corresponding windows cmd command achieve this?

in pure command line syntax

(for /f "tokens=3-5,10-12" %a in (testfile.txt) @echo %a %b %c %d %e %f)|find "cpu" 

the for /f command reads input file , each line readed splitted in indicated tokens using spaces , tabs delimiters, storing each of tokens in separate replaceable parameter alphabetically consecutive indicated starting replaceable parameter (%a in previous code). code after do clause executed each input line. full output of command filtered find show required lines.

the posted code written executed command line. inside batch files percent signs need escaped doubling them, so, %a should %%a, %b should %%b, ...


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -