Limit on amount of lines less can handle


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Limit on amount of lines less can handle
# 1  
Old 11-26-2013
Limit on amount of lines less can handle

Is there a limit on the amount of lines less can handle? I grepped for something that is pretty common in my files so I tried to filter it through less so it was easier to look at. So I then used a redirect ">" to create a file. It created a file that was 103K long. So that makes me think there is a limit on the amount of lines less can handle.
# 2  
Old 11-26-2013
Not sure I understand. Do you get an error msg? What does not work?
# 3  
Old 11-26-2013
Practically speaking, less is limited to the hundreds of megabytes on a 32-bit system.

But I don't think you can redirect less' output with > that way. It is an interactive application and kind of expects to be talking to a human via terminal, not a pipe, not a file.
Try fold -s to wrap lines.

Last edited by Corona688; 11-26-2013 at 11:44 AM..
# 4  
Old 11-26-2013
Quote:
Originally Posted by RudiC
Not sure I understand. Do you get an error msg? What does not work?
Sorry I didn't explain myself very well. I did this and less didn't work. So as I said above I think there is a limit on the amount of lines less can handle.

Code:
grep -riI 'word' /home/bob 2>/dev/null | grep less

Then I used this command to create the file. The file was 103K long.

Code:
grep -riI 'word' /home/bob 2>/dev/null > file

Quote:
Originally Posted by Corona688
Practically speaking, less is limited to the hundreds of megabytes on a 32-bit system.

But I don't think you can redirect less' output with > that way. It is an interactive application and kind of expects to be talking to a human via terminal, not a pipe, not a file.
Try fold -s to wrap lines.
These were the commands I used.

Code:
grep -riI 'word' /home/bob 2>/dev/null | grep less

Code:
grep -riI 'word' /home/bob 2>/dev/null > file

The file was 1.5 GB. I assume that is the reason less wouldn't work?
# 5  
Old 11-26-2013
You didn't use less. You looked for the string "less" using grep. Try changing:
Code:
grep -riI 'word' /home/bob 2>/dev/null | grep less

to:
Code:
grep -riI 'word' /home/bob 2>/dev/null | less

This User Gave Thanks to Don Cragun For This Post:
# 6  
Old 11-26-2013
Quote:
Originally Posted by Don Cragun
You didn't use less. You looked for the string "less" using grep. Try changing:
Code:
grep -riI 'word' /home/bob 2>/dev/null | grep less

to:
Code:
grep -riI 'word' /home/bob 2>/dev/null | less

Thank you. I wasn't reading carefully.
# 7  
Old 11-26-2013
You can speed up grep by turning off the regex engine, and simply doing a literal pattern search. grep -F specifies a fixed-string search as opposed to a regex search. The performance improvement can be dramatic for a bunch of huge text files.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH logging to file, limit lines

BASH Gurus: Anyone know how to append continuous output command appending to a file, but limit that file to no more than 20 lines? The program I have running is simply monitoring my UDP port 53 for incoming packets endlessly. I just need to keep this file from going over 20 lines. Once the file... (3 Replies)
Discussion started by: scorpius2k1
3 Replies

2. UNIX for Dummies Questions & Answers

Is there a limit in number of lines to be Copy pasted in VI editor ?

In my old shop, we only had AIX machines there (all of version 6.1 ). FTP ports were not open for these AIX machines because of some security thing. So, we can't ftp scripts in ASCII mode. When we wanted to copy huge scripts (shell scripts, sql scripts , ..etc) from our Windows based laptop... (6 Replies)
Discussion started by: kraljic
6 Replies

3. Shell Programming and Scripting

Reading from a file with limit number of lines

Hi, I am trying to pull data from a txt file which has 51 lines Example AK AR AL AZ CA CO CT Now i want to send above data as input to script but i want to run them twice at a time in a nohup like nohup Script_name AK & (3 Replies)
Discussion started by: krux_rap
3 Replies

4. UNIX for Dummies Questions & Answers

Limit reoccurrance of characters in lines

Hey guys and gals, Working on a script to limit the reoccurrance of characters in a line. sed "/\(.\).*\1/d" -i file.txt sed "/\(.\).*\1.*\1/d" -i file.txt sed "/\(.\).*\1.*\1.*1/d" -i file.txt .. To limit character reoccurance with 1x, 2x, 3x etc. However I would like to be able to... (2 Replies)
Discussion started by: TAPE
2 Replies

5. Solaris

Limit: stacksize: Can't remove limit

Hi all, I'm using to Solaris machine. When I run a simple script this messenger come out:"limit: stacksize: Can't remove limit". Any one know the way to resolve this problem without reboot the machine? Thanks in advance. (3 Replies)
Discussion started by: Diabolist9
3 Replies

6. UNIX for Dummies Questions & Answers

Difference between handle to the thread HANDLE and thread identifier pthread_t

This question might be silly but its confusing me a bit: What is the difference between handle to the thread HANDLE and thread identifier pthread_t? ---------- Post updated at 01:52 PM ---------- Previous update was at 01:48 PM ---------- Sorry I saw details and HANDLE is in windows and... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

7. AIX

Maximum Limit of HMC to handle Physical Power Virtualization Physical Machine

Hello All, Can anybody please tell me what is the maximum limit of Physical IBM Power Machine which can be handled by single HMC at a single point of time? Thanks, Jenish (1 Reply)
Discussion started by: jenish_shah
1 Replies

8. Shell Programming and Scripting

Limit of number of lines for awk and sed.

Hi, I'm using awk and sed to extract some data out from a text file. The text file consists of data over a million (prolly millions) of lines. Question: Is there a limit of number of lines for awk and sed? Thanks in advance. (2 Replies)
Discussion started by: 60doses
2 Replies

9. Shell Programming and Scripting

deleting a varying amount of lines from a list of files

I did search the posts for info on this and while there were some in the ballpark, none addressed this specifically. (also I tried to post this once it said I was logged out, so hopefully I'm not sending a duplicate here). I have a set of files (250 +/-) where I need to delete the first "$x"... (4 Replies)
Discussion started by: benair
4 Replies

10. Shell Programming and Scripting

PHP Outputting finite amount of lines from a file

Hi, I have the code below which outputs all the lines of a CSV file but I'd like it to only output 15 lines then save the current line as a variable which could be used (as a link) to display the next 15 lines. I can't get my head around the logic! Please help :D while ($data = fgetcsv($fp,... (1 Reply)
Discussion started by: pondlife
1 Replies
Login or Register to Ask a Question