using 'more' instead of 'cat' to pipe into another command
Hi, quick question. Since i am in the habit of using 'more' to view files, e.g.
I often use this command to pipe into other utilities like grep. For example,
would get all lines in the file that begin with ">". I know that it is generally recommended to use 'cat' for this purpose, so I was wondering if there is a speed difference between the two commands? In other words, would it be faster to say:
? Since i routinely work with very large text files, the speed difference could be important.
(Note: I realize that 'grep' takes a file argument like this:
but i am only using it as an example. It can be anything. I am more interested in the 'cat' vs. 'more' difference.)
Thanks!
Last edited by pludi; 07-01-2010 at 10:48 PM..
Reason: code tags, please...
There is a format difference between "more" and "cat". The "more" process includes screen formatting characters. Don't ever feed the output from "more" into a pipe for further processing, use "cat" or shell inward redirect.
Yes, that's what I meant. "more" is only meaningful when its output is the user's tty. When it is piped to a process, all the internal interaction logic is disabled.
also... when in "more", you can press "v" and the content will be loaded into "vi", it is very convenient, I learned it from unixacademy.com "Learn Linux For A Beginner" training
suppose i have a perl script that is normally run this way:
./checkdisk.pl -H hostname -w 40 -c 80
but, for whatever reason, i cannot run the script directly as it should. But i can cat it through pipe. How can i pass the arguments "-H hostname -w 40 -c 80"?
so this is what i'm doing,... (6 Replies)
I have two files as below
1.txt
AA 123
CC 145
DD 567
2.txt
AA 111
YY 128
CC 144
FF 222
DD 777
ZZ 875
basically 1.txt is updated file, if i do cat 1.txt 2.txt output should be as below
o/p (2 Replies)
Hi.
How can i write a command on AIX like the one i did at linux that find string in a file and show me that string, and return 3 lines before and 4 lines after that string.
my linux command is:
/bin/cat <filename> | tail -150 | grep -B2 -A8 "<string to look for>"
Example:
/bin/cat ... (10 Replies)
I have a file "sample.txt" with the content as below:
Hi
This is a Sample Text.
I need a single command using cat which serve the following purpose.
1.display the contents of sample.txt
2.append some text to it
3. and then exit
But, all should be served by a sinle... (1 Reply)
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
Dear All
I have two text files File1.txt and File2.txt . I am concatenating the two files and making it as single file Cat_File.txt. Now i need to keep joined file in two different path. that is I need to use cat command only once ,but store joined file in two different locations. Since... (3 Replies)
I would like to append some statement into 1 single file so that it can be concatenate together in 1 word. I have tried >> but it will seperate my 2 statement into 2 rows.
# cat abc.txt cde.txt > result.txt
where abc.txt is "abcde" and cde.txt is "12345"
the result should come out as... (3 Replies)
hi everybody,
how do i open a txt file writen in unix on to a web page
so when i want to view the txt file that was generated from a shell program, that file is open on a web page
do i use the cat > filename.html command to do this, or is there another way
many thanks
:D (2 Replies)