Print n lines from top and n lines from bottom of all files with .log extenstion
Oracle Linux 6.4
In a directory I have more than 300 files with the extension .log
I want the first 5 and last 5 lines of these .log files to be printed on screen with each file's name.
Expected output :
Code:
Printing first 5 and last 5 lines of FX_WT_Feb8_2014.log
!! Authentication dialogue with 10.79.60.158 failed
R: !! Failed to pull policy from policy server
R: !! Did not start the scheduler
There is no readable input file at promises.cf
!!! System error for stat: "No such file or directory"
!! Authentication dialogue with 10.79.60.158 failed
R: !! Failed to pull policy from policy server
R: !! Did not start the scheduler
cf-agent was not able to get confirmation of promises from cf-promises, so going to failsafe
There is no readable input file at promises.cf
grep for a particular pattern and remove 5 lines above the pattern and 6 lines below the pattern
root@server1 # cat filename
Shell Programming and Scripting test1
Shell Programminsada asda
dasd asd Shell Programming and Scripting Post New Thread
Shell Programming and S sadsa ... (17 Replies)
Hi all,
This should be very easy but I can't figure it out...
I have a file that looks like this:
@SRR057408.1 FW8Y5CK02R652T length=34
AGCAGTGGTATCAACGCAGAGTAAGCAGTGGTAT
+SRR057408.1 FW8Y5CK02R652T length=34
FIIHFF6666?=:88@@@BBD:::?@ABBAAA>8
@SRR057408.2 FW8Y5CK02TBMHV length=52... (1 Reply)
Hi Folks
I need a one liner to parse through a log and if the string is found print the line above, the line with the string and the line below.
example:
The ball is green and blue
Billy through the ball higer.
Jane got hurt with the ball.
So if I search for Billy I would need the 3... (1 Reply)
How to remove x lines form top and y lines form bottom.
This works, but like awk only cat file | head -n-y | awk 'NR>(x-1)'
so remove last 3 lines and 5 firstcat file | head -n-3 | awk 'NR>4' (5 Replies)
Hi,
I have a folder with multiple (< 33) .log files.
And I have to copy the lines between two patterns from all the .log files to a new file.
(script file with a loop?)
Thanks in advance.
1.log
...
..
xx1> begin
...
..
..
>>> Total: 2 Alarms
..
.. (17 Replies)
RHEL 5.8
In a directory I have more than 200 files with the extension .log
Using head command I want to print first 20 lines of each log file.
For each .log file, it should print like below
Printing first 20 lines of : GRP_error_April29.log
Apr 29 04:02:05 raptor03b syslogd 1.4.1:... (4 Replies)
Hi,
i have a file which contains PID and wanted to execute kill command. but the thing is, when killing PID's needs to kill PID from bottom to top.
Please help
INPUT
21414 sh -c extract.ksh ASA
21416 /bin/ksh extract.ksh ASA
21428 /usr/bin/perl -w /var/tmp/tempperl.21416 ASA... (4 Replies)
URGENT HELP IS NEEDED!!
I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but
- Currently, script is not printing lines to File3.txt in order.
- Also the matching lines are not moving out of File1.txt
... (1 Reply)
I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with:
wc -l *|sort
15263 Image.txt
16401 reference.txt
40459 richtexteditor.txt
How can I also print the number of unique lines in each file?
15263 1401 Image.txt
16401... (15 Replies)
Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" .
I have attached sample input file and the desired input should be as:
INPUT FORMAT:
SELECT
ABCD,
DEFGH,
DFGHJ,
JKLMN,
AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
LEARN ABOUT DEBIAN
cf-promises
cf-promises(8) System Manager's Manual cf-promises(8)NAME
cf-promises - cfengine's promise analyzer
SYNOPSIS :
cf-promises [options]
DESCRIPTION :
The promise agent is a validator and analysis tool for configuration files belonging to any of the components of Cfengine. Configurations
that make changes must be approved by this validator before being executed. cfengine is a self-healing configuration and change management
based system. You can think of cfengine as a very high level language, much higher level than Perl or shell. Asingle statement is called a
promise, and compliance can result in many hundreds of filesbeing created, or the permissions of many hundreds offiles being set. The idea
of cfengine is to create a one or more sets of configuration files which willclassify and describe the setup of every host in a network.
COMMAND LINE OPTIONS :
--help, -h
Print the help message
--bundlesequence, -b
Use the specified bundlesequence for verification
--debug, -d
Set debugging level 0,1,2,3
--verbose, -v
Output verbose information about the behaviour of the agent
--dry-run, -n
All talk and no action mode - make no changes, only inform of promises not kept
--version, -V
Output the version of the software
--file, -f
Specify an alternative input file than the default
--define, -D
Define a list of comma separated classes to be defined at the start of execution
--negate, -N
Define a list of comma separated classes to be undefined at the start of execution
--inform, -I
Print basic information about changes made to the system, i.e. promises repaired
--diagnostic, -x
Activate internal diagnostics (developers only)
--analysis, -a
Perform additional analysis of configuration
--reports, -r
Generate reports about configuration and insert into CFDB
AUTHOR
Mark Burgess and CFEngine AS
INFORMATION
Bug reports: http://bug.cfengine.com, .PP Community help: http://forum.cfengine.com
Community info: http://www.cfengine.com/pages/community
Support services: http://www.cfengine.com
This software is Copyright (C) 2008-2013 CFEngine AS.
Maintenance Commands cf-promises(8)