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'll try explain this as best I can. Let me know if it is not clear.
I have large text files that contain data as such:
143593502 09-08-20 09:02:13 xxxxxxxxxxx xxxxxxxxxxx 09-08-20 09:02:11 N line 1 test
line 2 test
line 3 test
143593503 09-08-20 09:02:13... (3 Replies)
Hi all,
on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern.
the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/'
I need to include the... (1 Reply)
Hi All,
This is very urgent, I've a data file with 1.7 millions rows in the file and the delimiter is cedilla and I need to format the data in such a way that if the NF in the next row is less than 1, it will append that value to previous line.
Any help will be appricated.
Thanks,... (17 Replies)
Hi ,
i have a file with data as below.This is same file. But actual file contains to many rows.
i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ?
Field 004... (7 Replies)
Hello,
I am trying to return a time multiple times from a file that has varying output just before the time instance, i.e.
cat jumped
cat jumped
cat jumped
time = 1.1
cat jumped
cat jumped
time = 1.2
cat jumped
cat jumped
time = 1.3
In this case i would like to output a time.txt... (6 Replies)
hello everyone,
im new here, and also programming with awk, sed and grep commands on linux.
In my text i have many lines with this config:
1 1 4 3 1 1 2 5
2 2 1 1 1 3 1 2
1 3 1 1 1 2 2 2
5 2 4 1
3 2 1 1 4 1 2 1
1 1 3 2 1 1 5 4
1 3 1 1... (3 Replies)
Hi,
i have a file with multiple entries. After some tests with sed i managed to get the file output as follows:
lsn=X-LINK-IN0,apc=661:0,state=avail,avail/links=1/1,
00,2110597,2094790,0,81,529,75649011,56435363,
lsn=TM1ITP1-AM1ITP1-LS,apc=500:0,state=avail,avail/links=1/1,... (5 Replies)
Hi All,
I need to print the characters in the previous line just before the regular expression match
Please have a look at the input file as attached
I need to match the regular expression ^ with the character of the previous like and also the pin numbers
and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
LEARN ABOUT HPUX
diffmk
diffmk(1) General Commands Manual diffmk(1)NAME
diffmk - mark changes between two different versions of a file
SYNOPSIS
prevfile currfile markfile
DESCRIPTION
compares the previous version of a file with the current version and creates a file that includes ``change mark'' commands. prevfile is
the name of the previous version of the file and currfile is the name of the current version of the file. generates markfile which con-
tains all the lines of the currfile plus inserted formatter ``change mark'' requests. When markfile is formatted, changed or inserted text
is shown by a character at the right margin of each line. The position of deleted text is shown by a single
If the characters and are inappropriate, a copy of can be edited to change them because is a shell script.
EXTERNAL INFLUENCES
International Code Set Support
Single- and multi-byte character code sets are supported.
EXAMPLES
A typical command line for comparing two versions of an file and generating a file with the changes marked is:
can also be used to produce listings of C (or other) programs with changes marked. A typical command line for such use is:
where the file contains:
The request can specify a different line length, depending on the nature of the program being printed. The request is probably needed only
for C programs.
WARNINGS
Aesthetic considerations may dictate manual adjustment of some output.
does not differentiate between changes in text and changes in formatter request coding. Thus, file differences involving only formatting
changes (such as replacing with in a text source file) with no change in actual text can produce change marks.
Although unlikely, certain combinations of formatting requests can cause change marks to either disappear or to mark too much. Manual
intervention may be required because the subtleties of various formatting macro packages and preprocessors is beyond the scope of cannot
tolerate commands in its input (see tbl(1)), so any request that would appear inside a range is silently deleted. The script can be
changed if this action is inappropriate, or can be run on two files that have both been run through the preprocessor before any comparisons
are made.
uses and thus has the same limitations on file size and performance that may impose (see diff(1)). In particular the performance is non-
linear with the size of the file, and very large files (well over 1000 lines) may take extremely long to process. Breaking the file into
smaller pieces may be advisable.
also uses the ed(1) editor. If the file is too large for error messages may be embedded in the file. Again, breaking the file into
smaller pieces may be advisable.
SEE ALSO diff(1), nroff(1).
diffmk(1)