Link to home
Start Free TrialLog in
Avatar of MSGK161091
MSGK161091Flag for Australia

asked on

Pipe output to file under Command Prompt

Windows experts
 
I am able to pipe output to file using > or append next output with >> . But all outputs are mixing up. so I like to put some word before the next output. Please see what I like to achieve.

Now :

exclude = C:\Program Files\Veritas\NetBackup\bin\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bprd.d\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bpsched.d\*.lock
exclude = C:\Program Files\Veritas\NetBackupDB\data\*
exclude = C:\Program Files\Veritas\Volmgr\misc\*
exclude = C:\WINDOWS\system32\config\AppEvent.Evt
exclude = C:\WINDOWS\system32\config\SecEvent.Evt
exclude = C:\WINDOWS\system32\config\SysEvent.Evt
exclude = C:\Program Files\Veritas\NetBackup\bin\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bprd.d\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bpsched.d\*.lock
exclude = C:\Program Files\Veritas\NetBackupDB\data\*
exclude = C:\Program Files\Veritas\Volmgr\misc\*
exclude = C:\WINDOWS\system32\config\AppEvent.Evt
exclude = C:\WINDOWS\system32\config\SecEvent.Evt
exclude = C:\WINDOWS\system32\config\SysEvent.Evt

I WANT  LIKE THIS:

ACCTS
exclude = C:\Program Files\Veritas\NetBackup\bin\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bprd.d\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bpsched.d\*.lock
exclude = C:\Program Files\Veritas\NetBackupDB\data\*
exclude = C:\Program Files\Veritas\Volmgr\misc\*
exclude = C:\WINDOWS\system32\config\AppEvent.Evt
exclude = C:\WINDOWS\system32\config\SecEvent.Evt
exclude = C:\WINDOWS\system32\config\SysEvent.Evt
BAGSALE
exclude = C:\Program Files\Veritas\NetBackup\bin\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bprd.d\*.lock
exclude = C:\Program Files\Veritas\NetBackup\bin\bpsched.d\*.lock
exclude = C:\Program Files\Veritas\NetBackupDB\data\*
exclude = C:\Program Files\Veritas\Volmgr\misc\*
exclude = C:\WINDOWS\system32\config\AppEvent.Evt
exclude = C:\WINDOWS\system32\config\SecEvent.Evt
exclude = C:\WINDOWS\system32\config\SysEvent.Evt

So When I copy all outputs once from file , So I may recognize know what output belong to which server.
Thanks!
Avatar of Bill Prew
Bill Prew

How is the output being generated, is it one piece at a time, or all at once.  If in pieces, then you can add your breaks when needed by doing:

echo BAGSALE >> logfile.txt

If all the lines are written at the same time from a single command or program, then you would need to define some rules about where the breaks are inserted.

~bp
Avatar of MSGK161091

ASKER

Hi Billprew
thanks for ur prompt reply.
But where  'echo' should fit in the  command because I tried few ways and it is reporting  error
Warning, unknown configuration item (BAGSALE)
Warning, unknown configuration item (echo)

Please see my command below and advise where to fit in

F:\Program Files\Veritas\NetBackup\bin\Admincmd>bpgetconfig -M BAGSALE exclude >> echo BAGSALE E:/Exclude.txt
Warning, unknown configuration item (BAGSALE)
Warning, unknown configuration item (echo)

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
btw i know you have your answer and bill knows this anyway but in case you dont know you can also redirect a whole batch of command in one go by enclosing them in (), e.g.

@echo off
(
echo %computername% at %date% %time%
yourprog.exe
someotherprog.exe
echo Finished %date %time%
echo.
) >logfile.txt

etc.

steve