Sponsored Content
Full Discussion: Replace entire line
Top Forums Shell Programming and Scripting Replace entire line Post 302351338 by thanhdat on Tuesday 8th of September 2009 08:27:35 AM
Old 09-08-2009
Just double the \ and it's done ^^
Code:
sed 's:LogFormat "%h %l %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined:LogFormat "\\"%h\\" \\"%l\\" \\"%u\\" \\"%t\\" \\"%r\\" \\"%>s\\" \\"%b\\" \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined:g' yourfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Search and replace entire line

I have a perl function in my script that needs to replace an entire line in a file sub changestate { my $base = (); my @base = (); open(BASE, $file) || die("Could not open file!"); @base=<BASE>; close (BASE); foreach $base(@base) { if($base =~... (1 Reply)
Discussion started by: insania
1 Replies

2. Shell Programming and Scripting

Replace Entire line if any part matches regexp

Hey guys, I have a file that I've slowly been awking, seding, and greping for data entry. I am down to pull the addresses out to insert them into an excel file. Each address is a few lines, but i want to put a semicolon delimiter in between each address so I can export the text file into excel and... (6 Replies)
Discussion started by: Cocoabean
6 Replies

3. Shell Programming and Scripting

Print the entire line if second field has value P

Friends, I have .txt file with 3 millions of rows. File1.txt ABC1|A|ABCD1|XYZ1 ABC2|P|ABCD2|XYZ2 ABC3|A|ABCD3|XYZ3 ABC4|P|ABCD4|XYZ4 If second field has value P then print the entire line. Thanks in advance for your help, Prashant (4 Replies)
Discussion started by: ppat7046
4 Replies

4. UNIX for Advanced & Expert Users

command to replace the entire line from the key point

Hi everyone I am new to Unix. I got stuck up by small issue. I have text file something like this abc 'xyz' '5' lmn 'pqr' '7' i want to replace the abc 'xyz' '5' to abc 'xyz' '6' but i have a key as 'xyz' based on this key i want to do that. I am not aware of how to use sed... (7 Replies)
Discussion started by: Vijayaragavan
7 Replies

5. Shell Programming and Scripting

grep to find entire line ....

As per my understanding below mentioned line of code finding a word 'boy' in $ACULOG... num_errors=`grep -i -e fail -e illegal -e exception -e "<E" -e boy $ACULOG | wc -l` if I'm not corerct, please correct me. How I can find entire line like "This is a boy" with something similar as above... (1 Reply)
Discussion started by: heyitsmeok
1 Replies

6. UNIX for Dummies Questions & Answers

Show the entire line using ps

Using the vanilla ps -ef I noticed that the CMD (or command) line gets cut off after 90 characters UID PID PPID C STIME TTY TIME CMD root 6020 3822 0 Jun 19 ? 0:01 ./webservd-wdog -r /export/opt/sows/61sp4 -d /export/opt/sows/61sp4/https-logse Googling... (4 Replies)
Discussion started by: SixSigma1978
4 Replies

7. Shell Programming and Scripting

Replace character in files of entire folder? sed? or what?

Hello, I do have several files in one folder each file contains measurement data. for each file I would like to replace the character "," by "." ? How can I do this and how can I do this for each file at once? E.G. data_1.dat, data_x.dat (original version) data_1out.dat, data_x_out.dat... (10 Replies)
Discussion started by: rollinator
10 Replies

8. Shell Programming and Scripting

Help with sed to replace entire line

Hi, I need to replace an entire mailx line as follows using sed: sed -e 's/<line1>/<newline>/g' <filename> But I am getting comman garbled error since the new line has many special characters. I enclosed allspecial chars in \ but still no use. Can any one help me? Please use code... (2 Replies)
Discussion started by: vinodhin4
2 Replies

9. Shell Programming and Scripting

Using the entire line with space in between

Hi Folks, I have a report data like the one seen below. FRUITS@NEW_ORANGE(1500 04/29) FRUITS@NEW_ORANGE(1500 05/04) FRUITS@NEW_ORANGE(1500 05/05) FRUITS@NEW_ORANGE(1500 05/07) FRUITS@NEW_ORANGE(1500 05/12) I need to use each of this lines separately in another for loop like the one... (2 Replies)
Discussion started by: jayadanabalan
2 Replies

10. Shell Programming and Scripting

How to extract entire para instead of just line?

Hello, I have a file with multiple paragraphs/sections each starting with word "Handle" and if I grep for a pattern, I should get contents of entire section/para (not just line). Please advise, thanks! #script.sh file.txt "System Information" Handle 0x0001 DMI type 1, 27 bytes. ... (9 Replies)
Discussion started by: reddyr
9 Replies
VLOGGER(1)						User Contributed Perl Documentation						VLOGGER(1)

NAME
vlogger - flexible log rotation and usage tracking in perl SYNOPSIS
vlogger [OPTIONS]... [LOGDIR] DESCRIPTION
Vlogger is designed to make webserver log rotation simple and easy to manage. It deals with VirtualHost logs automatically, so only one directive is required to manage all hosts on a webserver. Vlogger takes piped output from Apache or another webserver, splits off the first field, and writes the logs to logfiles in subdirectories. It uses a filehandle cache to avoid resource limitations. It will start a new logfile at the beginning of a new day, and optionally start new files when a certain filesize is reached. It can maintain a symlink to the most recent log for easy access. Optionally, host parsing can be disabled for use in ErrorLog directives. To use vlogger, you need to add a "%v" to the first part of your LogFormat: LogFormat "%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined Then call it from a customlog: CustomLog "| /usr/sbin/vlogger -s access.log -u www-logs -g www-logs /var/log/apache" combined OPTIONS
Options are given in short format on the command line. -a Do not autoflush files. This may improve performance but may break logfile analyzers that depend on full entries in the logs. -e ErrorLog mode. In this mode, the host parsing is disabled, and the file is written out using the template under the specified LOGDIR. -n Disables rotation. This option disables rotation altogether. -f MAXFILES Maximum number of filehandles to keep open. Defaults to 100. Setting this value too high may result in the system run- ning out of file descriptors. Setting it too low may affect performance. -u UID Change user to UID when running as root. -g GID Change group to GID when running as root. -t TEMPLATE Filename template using Date::Format codes. Default is "%m%d%Y-access.log", or "%m%d%Y-error.log". When using the -r option, the default becomes "%m%d%Y-%T-access.log" or "%m%d%Y-%T-error.log". -s SYMLINK Specifies the name of a symlink to the current file. -r SIZE Rotate files when they reach SIZE. SIZE is given in bytes. -d CONFIG Use the DBI usage tracker. -h Displays help. -v Prints version information. DBI USAGE TRACKER
Vlogger can automatically keep track of per-virtualhost usage statistics in a database. DBI and the relevant drivers (eg. DBD::mysql) needs to be installed for this to work. Create a table in your database to hold the data. A "mysql_create.sql" script is provided for using this feature with MySQL. Configure the dsn, user, pass and dump values in the vlogger-dbi.conf file. The "dump" parameter controls how often vlogger will dump its stats into the database (the default is 30 seconds). Copy this file to somewhere convienient on your filesystem (like /etc/apache/vlogger-dbi.conf) and start vlogger with "-d /etc/apache/vlogger-dbi.conf". You might want to use this feature to easily bill customers on a daily/weekly/monthly basis for bandwidth usage. SEE ALSO
cronolog(1), httplog(1) BUGS None, yet. AUTHORS Steve J. Kondik <;shade@chemlab.org> WWW: http://n0rp.chemlab.org/vlogger perl v5.8.6 2005-03-18 VLOGGER(1)
All times are GMT -4. The time now is 04:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy