Discussion:
dos equivalent of "cut" command?
(too old to reply)
Ameya
2007-08-23 13:49:38 UTC
Permalink
Hello,

I am trying to cut a specific column from a piece of text that I get
as an output through piping. I know that in Linux the "cut" command
does the trick but I do not know what is the command for that in DOS
or if I can do it in dos command line. It would be great if anyone can
help me in this.

The command is as follows:

type abc.txt | find "Hello" | (I don't know what command to use to cut
a specific column)

Thanks in advance

Regards,
Ameya
Robert Riebisch
2007-08-23 14:21:38 UTC
Permalink
Post by Ameya
I am trying to cut a specific column from a piece of text that I get
as an output through piping. I know that in Linux the "cut" command
does the trick but I do not know what is the command for that in DOS
or if I can do it in dos command line. It would be great if anyone can
help me in this.
A 16-bit `cut' for DOS is here:
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/gnuish/dos_only/tut111ax.zip
--
Robert Riebisch
Bitte NUR in der Newsgroup antworten!
Please reply to the Newsgroup ONLY!
Matthias Tacke
2007-08-23 15:52:56 UTC
Permalink
Post by Ameya
Hello,
I am trying to cut a specific column from a piece of text that I get
as an output through piping. I know that in Linux the "cut" command
does the trick but I do not know what is the command for that in DOS
or if I can do it in dos command line. It would be great if anyone can
help me in this.
type abc.txt | find "Hello" | (I don't know what command to use to cut
a specific column)
You are posting from wndows XP, so you might take "for /f" for column parsing.
See for /?

Or since you are used to use cut - use cut ;-) via cygwin or a windows port
like in unxutils http://sourceforge.net/project/showfiles.php?group_id=9328
--
Greetings
Matthias
Ted Davis
2007-08-23 20:49:49 UTC
Permalink
Post by Ameya
Hello,
I am trying to cut a specific column from a piece of text that I get
as an output through piping. I know that in Linux the "cut" command
does the trick but I do not know what is the command for that in DOS
or if I can do it in dos command line. It would be great if anyone can
help me in this.
type abc.txt | find "Hello" | (I don't know what command to use to cut
a specific column)
cut for Windows, and when you say DOS, I assume you mean Win32, is part
of the CoreUtils package from GnuWin32:
<http://gnuwin32.sourceforge.net/packages/coreutils.htm>.
--
T.E.D. (***@umr.edu)
Terence
2007-08-23 23:14:01 UTC
Permalink
As I read your posting, you have ended up with a block of ascii text
as a result of piping operationes from DOS command line instructions.

You want to eliminate a column from the lines of resulting text (i.e.
the nth character in each row line)..

I use WORDSTAR exclusively, and I can do what you want by first
switching on column mode editing with ^KN (a toggle), then select the
column or columns with ^KB before the first column on the first line
and ^KK after the end column on the last line to be affected.
.
Then I can cut the block of columns with ^KY, or cut and paste with
to somehwere else with ^KV.

These facilities are also in Vedit.
Ted Davis
2007-08-24 01:14:24 UTC
Permalink
Post by Terence
As I read your posting, you have ended up with a block of ascii text
as a result of piping operationes from DOS command line instructions.
You want to eliminate a column from the lines of resulting text (i.e.
the nth character in each row line)..
I use WORDSTAR exclusively, and I can do what you want by first
switching on column mode editing with ^KN (a toggle), then select the
column or columns with ^KB before the first column on the first line
and ^KK after the end column on the last line to be affected.
.
Then I can cut the block of columns with ^KY, or cut and paste with
to somehwere else with ^KV.
These facilities are also in Vedit.
And in UltraEdit and many other editors that are equally useless in a
batch file or from the command line.

Personally, I almost always use a text editor (UltraEdit) for column and
awk scripts for field isolation.
--
T.E.D. (***@umr.edu)
Ameya
2007-08-24 08:34:20 UTC
Permalink
Post by Ted Davis
Post by Terence
As I read your posting, you have ended up with a block of ascii text
as a result of piping operationes from DOS command line instructions.
You want to eliminate a column from the lines of resulting text (i.e.
the nth character in each row line)..
I use WORDSTAR exclusively, and I can do what you want by first
switching on column mode editing with ^KN (a toggle), then select the
column or columns with ^KB before the first column on the first line
and ^KK after the end column on the last line to be affected.
.
Then I can cut the block of columns with ^KY, or cut and paste with
to somehwere else with ^KV.
These facilities are also in Vedit.
And in UltraEdit and many other editors that are equally useless in a
batch file or from the command line.
Personally, I almost always use a text editor (UltraEdit) for column and
awk scripts for field isolation.
--
- Show quoted text -
Hello Everyone,

Thank you for your replies. I have downloaded Cygwin and I can use all
the unix commands in windows environment now.

Regards,
Ameya
Ted Davis
2007-08-24 12:54:53 UTC
Permalink
Post by Ameya
Hello Everyone,
Thank you for your replies. I have downloaded Cygwin and I can use all
the unix commands in windows environment now.
Be aware that Cygwin, while useful, is not a real solution in the Windows
environment - for one thing, some of the utilities are not up to current
feature standards (I recently got bitten by Cgwin's head which doesn't
recognize the byte offset switch). The real solution is the GnuWin32
collection of utilities. These are native Windows programs and use
Windows conventions (mostly) for file names and the like. If you need
bash, use Cygwin, otherwise use the GnuWin32 utilities (the ones that
don't work in windows mostly don't work in Cygwin either because the
problem is lack of support in the underlying operating system).
--
T.E.D. (***@umr.edu)
Alejandro Lieber
2007-08-30 00:03:14 UTC
Permalink
Post by Ameya
Hello,
I am trying to cut a specific column from a piece of text that I get
as an output through piping. I know that in Linux the "cut" command
does the trick but I do not know what is the command for that in DOS
or if I can do it in dos command line. It would be great if anyone can
help me in this.
type abc.txt | find "Hello" | (I don't know what command to use to cut
a specific column)
Thanks in advance
Regards,
Ameya
A very good shareware Dos text editor that can cut columns is Boxer:

BOXER is a remarkably full-featured text editor which has quickly become
the favorite of all types of computer users: programmers and writers,
power users and novices. BOXER is the result of a 10-year effort by a
self-proclaimed perfectionist, and the outcome is a highly polished
software program. Attention to detail is apparent throughout: BOXER's
interface is smooth, intuitive and courteous. Designed with an emphasis
on flexibility, BOXER can be easily configured to suit most every user's
taste. New users consistently praise BOXER in the strongest terms.

A complete feature list would be huge, so here are some of BOXER's most
important capabilities: multi-level Undo and Redo, Color Syntax
Highlighting, multiple files and windows, full mouse support, keyboard
reconfiguration, support for extended screen sizes, column marking,
macros, color, pull-down menus, word processing, and context sensitive
online help. Also: search with wildcards, compile within the editor,
small footprint shell, graphic drawing mode, auto indent, find mating
parenthetical characters, block commands: cut, copy, append, paste,
delete, write, print, fill, sort, total, average, case convert, invert,
entab, detab, more! Software from David Hamel $49-89.

** BOXER 7.5 adds many new features and options! **

Windows Clipboard Support: BOXER/DOS and TKO now communicate directly
with the clipboard in Windows 3.1 and Windows 95. Paste text directly
into Boxer from the Windows clipboard; paste text from Boxer into other
desktop programs!

Long Filename Support: BOXER/DOS and TKO provide full support for
creating and editing long filenames in Windows 95. Filenames can be up
to 255 characters long, contain embedded spaces, and use upper and lower
case!

Date Sorting: Boxer has a comprehensive date sort capability which
supports both domestic and international numeric date formats. Sort
lines by mdy, dmy or ymd, with two- or four-digit years, with or without
date separators!

Syntax Highlighting: a third set of up to 1,024 reserved words can be
defined and distinctly colored. Use wildcards (? and *) to quickly
define entire classes of reserved words. Also: enhanced comment
handling; new syntax info for Java, 4DOS, HTML and Perl.

Extra Clipboards, Index: ten additional clipboards areas have been
added in version 7.5. Use the new Index page within Boxer's Clipboard
Manager to view a summary of all 36 clipboards at a single glance.

Longer Lines: BOXER/OS2 and BOXER/TKO can now edit files with lines up
to 3000 characters in length.
--
My DOS programs: hhtp://www.lieber.com.ar

---------------------
Ing. Alejandro Lieber
Rosario Argentina
---------------------
Loading...