1.

Solve : find and to show some word.?

Answer»

in hardware.txt

Code: [Select]USB\VID_0586&PID_3410\5&21F0A827&0&1                        : ZyXEL G-202 Wireless USB ADAPTER #3
USB\VID_0766&PID_001D\FDC0FD10EA00000FD0FCAF51827474        : USB Mass Storage Device
USB\VID_0AC8&PID_307B\5&21F0A827&0&2                        : ZSMC USB PC CAMERA (ZS0211)
USB\VID_1058&PID_1010\57442D57584C304534395050373135        : USB Mass Storage Device
I want to show in command line. How i do?

USB\VID_0586&PID_3410\5&21F0A827&0&1
USB\VID_0766&PID_001D\FDC0FD10EA00000FD0FCAF51827474
USB\VID_0AC8&PID_307B\5&21F0A827&0&2
USB\VID_1058&PID_1010\57442D57584C304534395050373135

Sorry my bad English? download coreutils or gawk, and on command line

Code: [Select]C:\test>cut -f1 -d":" hardware.txt
USB\VID_0586&PID_3410\5&21F0A827&0&1
USB\VID_0766&PID_001D\FDC0FD10EA00000FD0FCAF51827474
USB\VID_0AC8&PID_307B\5&21F0A827&0&2
USB\VID_1058&PID_1010\57442D57584C304534395050373135

C:\test>gawk -F":" "{print $1}" FILE
USB\VID_0586&PID_3410\5&21F0A827&0&1
USB\VID_0766&PID_001D\FDC0FD10EA00000FD0FCAF51827474
USB\VID_0AC8&PID_307B\5&21F0A827&0&2
USB\VID_1058&PID_1010\57442D57584C304534395050373135
In batch file. Can you do ?  Quote from: mepmep on April 01, 2010, 08:32:12 AM

In batch file. Can you do ? 
sure, open your editor, type the command in,
Code: [Select]gawk -F":" "{print $1}" file
then save as mybatch.bat, that's it.


Discussion

No Comment Found