Sponsored Content
Top Forums Shell Programming and Scripting Delete a line in a file starting with - Perl one-liner Post 302390929 by ammu on Friday 29th of January 2010 12:08:12 PM
Old 01-29-2010
Delete a line in a file starting with - Perl one-liner

Hi

I need a perl onliner to delete a line in a file starting with few words.
Example

file.txt
----------
my name is don
I live in London
I am woking as engineer

I want to delete a line starting with 'I live in' using perl oneliner and in place edit with out temporary files

Thanks in advance
Ammu
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete the last line in a file using AWK or PERL

Is it possible to delete the last line in a file usin awk or perl? (4 Replies)
Discussion started by: suman_jakkula
4 Replies

2. Programming

How to delete N bytes from the starting of the file from a C function???

Hi, I want to delete the initial few lines (or even bytes) from a file. I want to do this from a C function & this is in Linux platform. The truncate & ftruncate is allowing me to delete bytes from the end only. Any linux C function calls or ideas or any suggestions?? I'm in a dead... (2 Replies)
Discussion started by: jockey007
2 Replies

3. Shell Programming and Scripting

How to delete initial N bytes from the starting of the file using sed?

I want to delete initial N bytes of a file using sed. How can I do that? (3 Replies)
Discussion started by: jockey007
3 Replies

4. Shell Programming and Scripting

how to delete text from line starting pattern1 up to line before pattern2?

My data is xml'ish (here is an excerpt) :- <bag name="mybag1" version="1.0"/> <contents id="coins"/> <bag name="mybag2" version="1.1"/> <contents id="clothes"/> <contents id="shoes"/> <bag name="mybag3" version="1.6"/> I want to delete line containing mybag2 and its subsequent... (5 Replies)
Discussion started by: repudi8or
5 Replies

5. Shell Programming and Scripting

Search & Replace regex Perl one liner to AWK one liner

Thanks for giving your time and effort to answer questions and helping newbies like me understand awk. I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk. Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Discussion started by: verge
9 Replies

6. Shell Programming and Scripting

Delete entire line starting with space

Folks, How do i delete an entire line that starts with blank space? Ex: I have a file like below. abc def (10/12) ghi _________ jkl _________ mno pqr stu (11/12) vwx I need the ouput like abc def (10/12) ghi pqr stu (11/12) vwx Thanks for your elp in advance !!!! (2 Replies)
Discussion started by: jayadanabalan
2 Replies

7. Shell Programming and Scripting

Delete line - Perl one liner

Hi all, I need a Perl one liner which prints a newline into a .txt file, only where the line starts with "/mediawiki-1.19.0/". It should add the newline to the line before. My problem is, when I try to realize this (with my little knowledge :rolleyes: ) i come to the point where the // are... (4 Replies)
Discussion started by: Mr.Smith
4 Replies

8. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

9. Shell Programming and Scripting

Checking and replacing first line in text file, one-liner?

Hello, I'm looking to check only the first line of a file to see if it is a format string, like # -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2if the first line is anything else, insert the above string. I'd... (3 Replies)
Discussion started by: f77hack
3 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
ASLMANAGER(8)						    BSD System Manager's Manual 					     ASLMANAGER(8)

NAME
aslmanager -- Apple System Log data life-cycle manager SYNOPSIS
aslmanager [-s store_dir] [-a [archive_dir]] [-ttl days] [-store_ttl days] [-module_ttl days] [-size max_size] [-asldb] [-module [name]] [-checkpoint] [-d [level]] [-dd [level]] DESCRIPTION
aslmanager manages rotated files and ASL data written by the syslogd server. It is started automatically at various times by syslogd. It may also be invoked from the command line by the superuser (root). It manages the life-cycle of data in the ASL database, rotated log files, and ASL directory data stores. Configuration information for aslmanager comes from the /etc/asl.conf configuration file, any ASL output mod- ule configuration files in the /etc/asl directory, and from command-line options that may be specified to override some settings found in the configuration files. In normal operation, it first checks the ASL database in /var/log/asl, then it checks the files and directories speci- fied by /etc/asl.conf and each ASL output module. If the -asldb flag is specified, then only the ASL database will be processed. If the -module flag is specified, then the ASL database will not be processed. All ASL output modules, or a single module if name is speci- fied, will be processed. If -checkpoint is specified, then aslmanager will signal syslogd to checkpoint files for all modules, or for a single named module, before processing. The -d flag causes aslmanager to print debug messages tracing it's actions as they are performed. An integer value (1, 2, or 3) may follow the -d flag. Higher values cause more fine-grained messages to be printed. The default value is 1. The -dd flag directs aslmanager to do a ``dry run''. Debug messages are printed as with -d, but no actions are actually performed. An optional debug level may follow the -dd flag. ASL DATABASE MANAGEMENT aslmanager scans the ASL database in /var/log/asl, or some other path specified by the setting of the ``store_path'' parameter in asl.conf, or by the path supplied following the -s flag. Data files that are older than the time-to-live for the database are either archived or removed. Files that contain messages with explicit expire times are removed or archived monthly after all their contents expire. The default 7 day time-to-live value may be overridden by the setting of the ``store_ttl'' parameter in asl.conf or by supplying a value follow- ing the -store_ttl flag or the -ttl flag (which overrides the time-to-live for both the ASL database and for all ASL modules). A time-to- live value of zero allows files to remain in the store with no time limit. A maximum size for the entire database is provided by the setting of the ``max_store_size'' parameter in asl.conf, or as a value following the -size flag. This will cause aslmanager to archive (if enabled) and remove files to keep the database size below the specified limit. The default value is 150000000 bytes. A value of zero means the size is unlimited. An unlimited size specification should be used with great caution, since a runaway process could quickly fill all available disk space. Files are removed in order starting from oldest to new- est. Files with the same date are removed in standard lexicographic sort order by file name. Files are either removed entirely or copied to an archive directory. If the -a flag is specified with no argument, files are copied to the /var/log/asl.archive directory. An alternate directory path may be specified following the -a flag. The archive parameter setting in asl.conf enables or disables archiving. The archive parameter requires a value of "1" to enable archiving, or a value of "0" to disable it. An option archive directory path may follow the "0" or "1". ASL OUTPUT MODULE MANAGEMENT For each ASL output module, or a single module specified as an argument following -module, aslmanager first locates all checkpoint files pro- duced by syslogd for that module. aslmanager checks all ASL directory data stores and all rotated log files - those with a ``rotate'' option in the module's configuration rules. Checkpoint files are renamed if necessary to conform to the naming style specified for the file by a ``style'' option in the module's configuration file. aslmanager will compress the file if directed by a ``compress'' option, and it will move the file to a destination directory if a ``dest'' option is specified for the file. Following this, aslmanager will delete expired files. The time-to-live for files is 7 days by default, but may be specified using the ``ttl'' option for the file in the module's configu- ration rules. If -module_ttl or -ttl are specified command line, then value specified as an argument is used as a time-to-live instead. -module_ttl specifies time-to-live for module processing. -ttl specifies time-to-live for both the ASL database and for modules. Finally, if the ``all_max'' option is specified for the output file, aslmanager checks the total size of all the rotated versions, and will delete them, (oldest first) to limit the total size as specified by ``all_max''. When processing ASL directory data stores, aslmanager will similarly delete data files after the expiry of their time-to-live, and will delete data files (oldest first) to limit the total size as specified by ``all_max''. SEE ALSO
syslogd(8), syslog(1), asl(3), asl.conf(5), syslog(3). HISTORY
The aslmanager utility appeared in Mac OS X 10.6. Support for log file and ASL directory life-cycle management was added in OS X 10.9. Mac OS X December 7, 2007 Mac OS X
All times are GMT -4. The time now is 02:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy