Tuesday, May 14, 2013

Benefits and drawbacks of scripts and batch programs?

Q. can you give me a specific pair of comparable DOS and LINUX commands that would be most useful in a batch or script file.
Can you please let me know how they compare and might be used, give benefits and drawbacks thanks.

A. DOS = findstr
UNIX = grep

These two commands are used to examine the CONTENTS of files for a specific string of characters. This is the equivalent of asking the question, "If string 'xxx' exists in file(s) yyy".

DOS = type
UNIX = cat

Cat is short for "concatenate." While it can be used to join files (mostly text files), its primary use is to write data from a file to the screen (UNIX stdout). Using redirection (pipes), output can be sent to files and printers.

There are many more. Generally, UNIX scripting commands have more options and more capabilities than their DOS counterparts.

What would happen if I tried this Linux command?
Q. I am wondering what would happen if I tried this command under my root account on my computer:

# passwd -l root

Any ideas? Has anyone tried this? I don't have any other accounts as sudoers.

A. might explode?

What's the linux command to do 'grep' on multiple file under the same dir?
Q. Hi I was wondering if this is the correct command when I want to do 'grep' on multiple files in the same folder

cat 1.txt | cat 2.txt | cat 3.txt |cat 4.txt | grep text

Thanks!

A. grep -n text *.txt



Nec Projector Review

Plastic Shed Reviews

Ati Graphic Reviews

Nurse Uniforms Reviews

Cabochons Reviews

Inflatable Water Slides Reviews

Barcode Scanner Reviews

No comments:

Post a Comment