I want below to compare two Consecutive line(i.e. current and next line). Based in that i need OP. Below is the IP file in that in i find "M" and if in next line i find "*" then i need both line in single line. If i dont find "*" in next line then i need to put commend "DOWN" .
I am using below script but its not print all line. Its ommite some line. Kindly suggest changes.
Hi,
how can i print the previous, current and next line using sed?
current line is the matching line.
The following prints all lines containing 'Failure' and also the immediate next line
cat $file | sed -n -e '/Failure/{N;p;}'
Now, i also want to print the previous line too.
Thanks,... (8 Replies)
Hello,
I have two files that I need to compare and print out the line from file2 that has the first 6 fields matching the first 6 fields in file1. Complicating this are the following restrictions
1. file1 is only a few thousand lines at most and file2 is greater than 2 million
2. I need to... (7 Replies)
Ok I have a file with hundreds of lines, four columns, space delimited, TESTB.TXT for example
TESTB.TXT
---
AA ZZ 12 34
BB YY 56 78
CC XX 91 23
DD VV 45 67
---
I want a new file that has 7 columns, the first four are identical, and the next 3 are the last three of the next line...so... (5 Replies)
Hello,
Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line.
i am using string as "testing"
netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h
i am able to get the previous line current line next line but... (1 Reply)
i want to compare two file and print same line
file1
12345 a
23456 a
45678 a
45679 a
file2
23456 a
34567 a
45679 a
output
23456 a
45679 a
any one can help me? Thank you (7 Replies)
hi! i researched about comparing two columns here and got an answer. but after examining my two files, i found out that the first columns of the two files are not unique with each other. all i want to compare is the 2nd and 3rd column.
FILE 1:
ABS 456 315
EBS 923 163
JYQ3 654 237
FILE 2:... (1 Reply)
Hi guys,
I have found your forum super useful. However, right now I am stuck on a seemingly "simple" thing in AWK. I have two columns of data, the first column in Age (in million years) and the second column is Convergence Rate (in mm/yr).
I am trying to process my data so I can use it to... (2 Replies)
Hi Guys
I have the following file
Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above:
Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Hi Gurus,
I have requirement to compare current result with previous reuslt.
The sample case is below.
1 job1 1
1 job2 2
1 job3 3
2 job_a1 1
2 job_a2 2
2 job_a3 3
3 job_b1 1
3 job_b2 2
for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Heyas
I'm thinking about a new approach for my core display, basicly as it should make aligments easier.
Issue i'm currently facing, is tput cup capable of printing on the current line?
My best achievements were:
:) tui $ tput cup - 60;echo " ------ testing" ------ testing... (5 Replies)
Discussion started by: sea
5 Replies
LEARN ABOUT MINIX
rewinddir
REWINDDIR(3) Linux Programmer's Manual REWINDDIR(3)NAME
rewinddir - reset directory stream
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
void rewinddir(DIR *dirp);
DESCRIPTION
The rewinddir() function resets the position of the directory stream dirp to the beginning of the directory.
RETURN VALUE
The rewinddir() function returns no value.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+------------+---------------+---------+
|Interface | Attribute | Value |
+------------+---------------+---------+
|rewinddir() | Thread safety | MT-Safe |
+------------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
SEE ALSO closedir(3), opendir(3), readdir(3), scandir(3), seekdir(3), telldir(3)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
2015-08-08 REWINDDIR(3)