• Status: Solved
• Priority: Medium
• Security: Public
• Views: 796

# 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!
0
MSGK161091
• 2
1 Solution

Commented:
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
0

Netbackup Storage SpecialistAuthor Commented:
Hi Billprew
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)

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)

0

Commented:
I think you will be doing the echo first as a seperate command.  This will write your line of text to divide the next section.  So something like this:

echo BAGSALE >>E:/Exclude.txt
bpgetconfig -M BAGSALE exclude >>E:/Exclude.txt

~bp
0

IT ConsultancyCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.