Hi,
I need a command that would let ls show number of lines in each file rather than file size in KBs.
I tried using wc -l as a source of input to ls but I found a problem cutting the file name since wc generates a space delimited list.
Any suggestions?
Thanks.
GmMike. (1 Reply)
When i grep for a pattern the search results comes up with matching lines(some before the pattern and some after)...how can i limit the search so that it shows only the lines after the pattern specified (5 Replies)
Hi experts,
I want to grep a number 9366109380 from a file but it will also show me the next 5 lines. Below is the example-
when i grep 989366109380, i can also see the next 5 lines.
Line 1. <fullOperation>MAKE:NUMBER:9366109380:PPAY2;</fullOperation>
Line 2.... (10 Replies)
I've seen several examples of grep showing the filename the string was found in, but what I really need is grep to show the file details in long format (like ls -l would).
scenario is:
grep mobile_number todays_files
This will show me the string I'm after & which files they turn up in, but... (2 Replies)
Can I modify the grep command to show only a process name?
Currently I run ps -efa | grep chk_web to get the following:
mousr 3395 1 0 09:36:06 pts/10 0:00 sh /var/opt/scripts/chk_web.sh
Can this be changed in any way to get only:
/var/opt/scripts/chk_web.sh or chk_web.sh.
I... (3 Replies)
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
I have a file like
blah
blah blah blah
this is the text I need,
which might be between 1-4 lines, but
always has a blank line above and below
it, and is at the end of the text file
the code tags don't show the trailing blank line. I started by deleting the last blank line with:
... (2 Replies)
I am using grep as follows
grep --include \*.org -ir "sunspot" -C 3 ./astron_aphys/solarsy/sun/helioseism/localhs/fhankel/
This gives me the filename for each matched line. How can I change the command to print the file name only once rather than having the same file name repeated at... (2 Replies)
Hi,
can I make grep stop after finding the first occurrence of a regex in a line?
Given:
file with various regex patterns
file to be grep'ed
Sadly some of the regex patterns cannot be limited any further, so grep -Eiof patterns.txt file.txt (GNU grep 2.20) will give me possibly n hits... (4 Replies)
Discussion started by: stresing
4 Replies
LEARN ABOUT DEBIAN
filecache
FileCache(3perl) Perl Programmers Reference Guide FileCache(3perl)NAME
FileCache - keep more files open than the system permits
SYNOPSIS
no strict 'refs';
use FileCache;
# or
use FileCache maxopen => 16;
cacheout $mode, $path;
# or
cacheout $path;
print $path @data;
$fh = cacheout $mode, $path;
# or
$fh = cacheout $path;
print $fh @data;
DESCRIPTION
The "cacheout" function will make sure that there's a filehandle open for reading or writing available as the pathname you give it. It
automatically closes and re-opens files if you exceed your system's maximum number of file descriptors, or the suggested maximum maxopen.
cacheout EXPR
The 1-argument form of cacheout will open a file for writing ('>') on it's first use, and appending ('>>') thereafter.
Returns EXPR on success for convenience. You may neglect the return value and manipulate EXPR as the filehandle directly if you prefer.
cacheout MODE, EXPR
The 2-argument form of cacheout will use the supplied mode for the initial and subsequent openings. Most valid modes for 3-argument
"open" are supported namely; '>', '+>', '<', '<+', '>>', '|-' and '-|'
To pass supplemental arguments to a program opened with '|-' or '-|' append them to the command string as you would system EXPR.
Returns EXPR on success for convenience. You may neglect the return value and manipulate EXPR as the filehandle directly if you prefer.
CAVEATS
While it is permissible to "close" a FileCache managed file, do not do so if you are calling "FileCache::cacheout" from a package other
than which it was imported, or with another module which overrides "close". If you must, use "FileCache::cacheout_close".
Although FileCache can be used with piped opens ('-|' or '|-') doing so is strongly discouraged. If FileCache finds it necessary to close
and then reopen a pipe, the command at the far end of the pipe will be reexecuted - the results of performing IO on FileCache'd pipes is
unlikely to be what you expect. The ability to use FileCache on pipes may be removed in a future release.
FileCache does not store the current file offset if it finds it necessary to close a file. When the file is reopened, the offset will be
as specified by the original "open" file mode. This could be construed to be a bug.
The module functionality relies on symbolic references, so things will break under 'use strict' unless 'no strict "refs"' is also
specified.
BUGS
sys/param.h lies with its "NOFILE" define on some systems, so you may have to set maxopen yourself.
perl v5.14.2 2010-12-30 FileCache(3perl)