Sponsored Content
Top Forums Shell Programming and Scripting Delete lines starting with these strings Post 302837497 by Little on Friday 26th of July 2013 02:16:12 AM
Old 07-26-2013
if you want to delete first 3 lines compulsorily, without matching the patterns then you can use
Code:
sed '1,3d' myapplication.log > myapp;mv myapp myapplication.log

deletes the 1st 3 lines from the file.
This User Gave Thanks to Little For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete lines starting with XX or YY or ZZ or ....

Hi There! My final task for today is to delete lines starting with certain numbers for e.g., my text block is and i want to delete all lines starting with 11 or 17 or 21 I know i can use multiple sed commands like sed '/^11,/d' <filename> sed '/^17,/d' <filename> sed '/^21,/d'... (2 Replies)
Discussion started by: orno
2 Replies

2. Shell Programming and Scripting

Grep and delete lines except the lines with strings

Hi I am writing a script which should read a file and search for certain strings 'approved' or 'removed' and retain only those lines that contain the above strings. Ex: file name 'test' test: approved package waiting for approval package disapproved package removed package approved... (14 Replies)
Discussion started by: vj8436
14 Replies

3. UNIX for Dummies Questions & Answers

Delete lines with duplicate strings based on date

Hey all, a relative bash/script newbie trying solve a problem. I've got a text file with lots of lines that I've been able to clean up and format with awk/sed/cut, but now I'd like to remove the lines with duplicate usernames based on time stamp. Here's what the data looks like 2007-11-03... (3 Replies)
Discussion started by: mattv
3 Replies

4. Shell Programming and Scripting

Search the word to be deleted and delete lines above this word starting from P1 to P3

Hi, I have to search a word in a text file and then I have to delete lines above from the word searched . For eg suppose the file is like this: Records P1 10,23423432 ,77:1 ,234:2 P2 10,9089004 ,77:1 ,234:2 ,87:123 ,9898:2 P3 456456 P1 :123,456456546 P2 abc:324234 (2 Replies)
Discussion started by: vsachan
2 Replies

5. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

6. Shell Programming and Scripting

delete lines starting with a pattern

i have a file sample.txt containing i want to delete lines starting with 123 neglecting spaces and tabs. but not lines containing 123. i.e. i want files sample.txt as help me thanxx (4 Replies)
Discussion started by: yashwantkumar
4 Replies

7. Shell Programming and Scripting

Delete multiple lines starting with a specific pattern

Hi, just tried some script, awk, sed for the last 2 hours and now need help. Let's say I have a huge file of 800,000 lines like this : It's a tedious job to look through it, I'd like to remove those useless lines in it as there's a few thousands : Or to be even more precise : if line1 =... (6 Replies)
Discussion started by: Zurd
6 Replies

8. Shell Programming and Scripting

How to delete lines starting with specific string?

Dear all, I would like to delete even lines starting with "N" together with their respective titles which are actually odd lines. Below is the example of input file. I would like to remove line 8 and 12 together with its title line, i.e., line 7 and 11, respectively.... (2 Replies)
Discussion started by: huiyee1
2 Replies

9. Shell Programming and Scripting

Delete all lines starting with # character

Tool used : VIM editor that comes with RHEL 7.4 I have a file like below. It has around 300 lines like below. All the lines starting with # are comments. For readability, I removed all lines starting with # from vi (vim editor) using the command :g/^#/d . It seemed to have worked. But, which... (8 Replies)
Discussion started by: John K
8 Replies

10. Shell Programming and Scripting

Delete all lines except a line starting with string

Shell : bash OS : RHEL 6.8 I have a file like below. $ cat pattern.txt hello txt1 txt2 txt3 some other text txt4 I want to remove all lines in this file except the ones starting with txt . How can I do this ? (4 Replies)
Discussion started by: omega3
4 Replies
POLICYGENTOOL(1)					      Debian GNU/Linux manual						  POLICYGENTOOL(1)

NAME
policygentool - Interactive SELinux policy generation tool SYNOPSIS
policygentool [options] <Module Name> <full path for application binary file> DESCRIPTION
This tool generate three files for policy development, A Type Enforcement (te) file, a File Context (fc), and a Interface File(if). Most of the policy rules will be written in the te file. Use the File Context file to associate file paths with security context. Use the interface rules to allow other protected domains to interact with the newly defined domains. The tool prompts for locations of pidfiles, any logfiles, files in /var/lib, and any init scripts, and whether any network access is desir- able for the application. The tool then generates the appropriate policy rules for the module. After these files have been generated, the make files for the appropriate SELinux policy, namely, /usr/share/selinux/refpolicy-targeted/include/Makefile or /usr/share/selinux/refpol- icy-strict/include/Makefile can be used to compile the SELinux policy policy package. The resulting policy package can be loaded using semodule. # /usr/bin/policygentool myapp /usr/bin/myapp # cat >Makefile > HEADERDIR:=/usr/share/selinux/refpolicy-targeted/include > include $(HEADERDIR)/Makefile > ^D # make # semodule -l myapp.pp # restorecon -R -v /usr/bin/myapp "all files defined in myapp.fc" # setenforce 0 # /etc/init.d/myapp start # audit2allow -R -i /var/log/audit/audit.log OPTIONS
-h, --help Print a short usage message. FILES
myapp.te, myapp.if, myapp.fc. SEE ALSO
semodule(8), check_policy(8), load_policy(8). BUGS
None known. AUTHOR
This manual page was written by Manoj Srivastava <srivasta@debian.org>, for the Debian GNU/Linux system. Debian Feb 27 2007 POLICYGENTOOL(1)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy