well, even a single command is going to require some work, as I assume you'll need to output the results of each individual file to a separate file.
furthermore, your loop will need to be a little more complex because you'll have to iterate over the whole grep result and keep track of the file on the current line, the line number, etc.
Hi all,
I need some help in grep command in a ksh script. Actually, i need to list all files having the file name like "BORD*.DAT" but exclude the files (from the list) having name like "BORD*mgt*.DAT". For that i used the following command:
ls | grep "BORD*.DAT" | grep -v "BORD*mgt*.DAT"
... (4 Replies)
Output all lines in the file temp that contain the word dog
using GREP only and in one line!!!
I tried grep ']dog]' temp
but it doesnt catch word dog when is at beginning or end, like:
Our dog is nice /this OK
Nice dog /this NOT
dog good /this NOT
Thank... (3 Replies)
dear ones
pl.kindly help me 1) how to print(grep) required pattern and following 2 or 3 lines. 2) grep required pattern(to print)+above 2 lines+below 2 or 3 lines.from a report file.
ex:
we have some report file
kf askfjsk fksaj fk skf sjfksjd kff sjfkjs kf jskdjfklsd jfklsdf sdkfjsd fsd... (3 Replies)
I am running a grep query for searching a pattern, and the output is quite huge. I want only the last 200 lines to be displayed, and I am not sure if tail will do the trick (can tail read from std in/out instead of files?).
Please help me out. (1 Reply)
I need help in printing multiple lines using a grep command.
The situation is like this.
I have a file that contains large number of lines
Now I need to find the the lines in the file such that if the word "AllServiceType" is found then the next line also gets printed.
Does anyone... (6 Replies)
Hi all,
I'm trying to select lines of a file and at the end do not have redundant itens:
Input
A_B
K_A
C_T
A_O
U_B
P_C
D_F
Z_G
W_U
Output
A_B
C_T
D_F
Z_G
W_U (2 Replies)
HI All,
I am using grep command to serach a pattern in a list of files and storing the output in a variable. Then i am applying some logic on that variable to get the required output.
But Thing is that when the pattern is present mutiple times in a file, i am getting the output of grep in a... (3 Replies)
Hi,
I am using below code snippet to echo/display the files found
(matching a pattern from searchstring.out file) and the corresponding owner.
while read j
do
echo "Pattern to search is:- $j"
find / -name "*$j*" |\
while read k
do
echo "File found is:- $k"
owner=$(ls... (9 Replies)
I have requirement to search for a text in the file and retrieve required lines that is user defined with unix command.
Eg:
Find the text UNIX in the below file and need to return Test 8 & Test 9
Test 1
Test 2
Test 3
Test 4
UNIX
Test 5
Test 6
Test 7
Test 8
Test 9
Result can... (8 Replies)
Discussion started by: Arunkumarsak4
8 Replies
LEARN ABOUT MOJAVE
topsyscall
topsyscall(1m) USER COMMANDS topsyscall(1m)NAME
topsyscall - top syscalls by syscall name. Uses DTrace.
SYNOPSIS
topsyscall [-Cs] [interval [count]]
DESCRIPTION
This program continually prints a report of the top system calls, and refreshes the display every 1 second or as specified at the command
line.
Since this uses DTrace, only users with root privileges can run this command.
OPTIONS -C don't clear the screen
-s print per second values
EXAMPLES
Default output, 1 second updates,
# topsyscall
Print every 5 seconds,
# topsyscall 5
Print a scrolling output,
# topsyscall -C
FIELDS
load avg
load averages, see uptime(1)
syscalls
total syscalls in this interval
syscalls/s
syscalls per second
SYSCALL
system call name
COUNT total syscalls in this interval
COUNT/s
syscalls per second
DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver-
bose descriptions explaining the output.
EXIT
topsyscall will run until Ctrl-C is hit, or the specified interval is reached.
AUTHOR
Brendan Gregg [Sydney, Australia]
SEE ALSO dtrace(1M), prstat(1M)version 0.90 Jun 13, 2005 topsyscall(1m)