Sponsored Content
Top Forums Shell Programming and Scripting Problems with Sed/awk/grep and line endings Post 302426063 by cfajohnson on Monday 31st of May 2010 02:23:05 PM
Old 05-31-2010
Quote:
Originally Posted by benwiggy
So, short of removing asterisks in the target file as I have done, how do you escape this behaviour, to deal with text files/strings that contain asterisks?
Quote them.
Quote:
One last thing: Do I need to make any changes if the input $FILENAME isn't the name of a file, but is simply a string containing all the data?
The same way as you used "$LIST".
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Vi line endings conversions

I was reading these 2 articles. Why does the wikia one think :e ++ff=dos? Or am I just misunderstanding it? :e ++ff=unix :e ++ff=dos File format - Vim Tips Wiki Managing/Munging Line-Endings with Vi/Vim | Jeet Sukumaran (1 Reply)
Discussion started by: cokedude
1 Replies

2. UNIX for Advanced & Expert Users

line endings help of non-ASCII files

When you are dealing with ASCII files it easy to check on line endings type. You can just use the file command. You are not always lucky enough to be dealing with ASCII files. So in the cases that you don't have ASCII files how can you check what type of line endings you have? Please list all... (5 Replies)
Discussion started by: cokedude
5 Replies

3. UNIX for Advanced & Expert Users

vimrc help with line endings

I was reading this and thought I could put this in my vimrc and it would convert the line endings to unix. Am I doing something wrong or am I missing something? set ff=unixManaging/Munging Line-Endings with Vi/Vim | Jeet Sukumaran I used this command and it confirms that my global option is... (2 Replies)
Discussion started by: cokedude
2 Replies

4. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

5. Shell Programming and Scripting

Use less pipe for grep or awk sed to print the line not include xx yy zz

cat file |grep -v "xx" | grep -v "yy" |grep -v "zz" (3 Replies)
Discussion started by: yanglei_fage
3 Replies

6. Shell Programming and Scripting

Sendmail ignoring line endings

Mails from Sendmail are ignoring line endings, when I try to send email with attachment. I have tried to specify the font in the html but line endings are still ignored. I also tried unix2dos, still no luck. #!/usr/bin/ksh ###Send Email MAILTO=`cat mail2.list | tr -s '\n' ','` SUBJECT="bla bla... (3 Replies)
Discussion started by: aydj
3 Replies

7. Shell Programming and Scripting

awk or sed or grep filter a line and/or between strings

Hi, I have multiple files on a directory with the following content: blahblah blahblah hostname server1 blahblah blahblah ---BEGIN--- aaa bbb ccc ddd ---END--- blahblah blahblah blahblah I would like to filter all the files with awk or sed or something else so I can get below... (6 Replies)
Discussion started by: bayupw
6 Replies

8. Shell Programming and Scripting

Sed/grep: check if line exists, if not add line?

Hello, I'm trying to figure out how to speed up the following as I want to use multiple commands to search thousands of files. is there a way to speed things up? Example I want to search a bunch of files for a specific line, if this line already exists do nothing, if it doesn't exist add it... (4 Replies)
Discussion started by: f77hack
4 Replies

9. Shell Programming and Scripting

sed or awk grep, that will only get the line with more characters.

Is there a command for sed and awk that will only sort the line with more characters? #cat file 123 12345 12 asdgjljhhho bac ss Output: asdgjljhhho #cat file2 11.2 12345.00 21.222 12345678.10 (2 Replies)
Discussion started by: invinzin21
2 Replies

10. UNIX for Beginners Questions & Answers

Tip to remove line endings and spaces on a pre-formatted text file?

Hi, At the moment, using Notepad++ to do a search and replace, manually section by section which is real painful. Yeah, so copying each section of the line of text and putting into a file and then search and replace, need at least 3-operations in Notepad++. Here's hoping I will be able to... (1 Reply)
Discussion started by: newbie_01
1 Replies
BIND::Config::Parser(3pm)				User Contributed Perl Documentation				 BIND::Config::Parser(3pm)

NAME
BIND::Config::Parser - Parse BIND Config file. SYNOPSIS
use BIND::Config::Parser; # Create the parser my $parser = new BIND::Config::Parser; my $indent = 0; # Set up callback handlers $parser->set_open_block_handler( sub { print " " x $indent, join( " ", @_ ), " { "; $indent++; } ); $parser->set_close_block_handler( sub { $indent--; print " " x $indent, "}; "; } ); $parser->set_statement_handler( sub { print " " x $indent, join( " ", @_ ), "; "; } ); # Parse the file $parser->parse_file( "named.conf" ); DESCRIPTION
BIND::Config::Parser provides a lightweight parser to the configuration file syntax of BIND v8 and v9 using a "Parse::RecDescent" grammar. It is in a similar vein to "BIND::Conf_Parser". However, as it has no knowledge of the directives, it doesn't need to be kept updated as new directives are added, it simply knows how to carve up a BIND configuration file into logical chunks. CONSTRUCTOR
new( ); Create a new "BIND::Config::Parser" object. METHODS
set_open_block_handler( CODE_REF ); Set the code to be called when a configuration block is opened. At least one argument will be passed; the name of that block, for example "options" or "zone", etc. as well as any additional items up to but not including the opening curly brace. set_close_block_handler( CODE_REF ); Set the code to be called when a configuration block is closed. No arguments are passed. set_statement_handler( CODE_REF ); Set the code to be called on a single line configuration element. At least one argument will be passed; the name of that element, as well as any additional items up to but not including the ending semi-colon. parse_file( FILENAME ); Parse FILENAME, triggering the above defined handlers on the relevant sections. TODO
Probably the odd one or two things. I'm fairly sure the grammar is correct. COPYRIGHT AND LICENSE
Copyright (c) 2005 Matt Dainty. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHORS
Matt Dainty <matt@bodgit-n-scarper.com>. SEE ALSO
perl, Parse::RecDescent, BIND::Conf_Parser. perl v5.14.2 2005-06-26 BIND::Config::Parser(3pm)
All times are GMT -4. The time now is 02:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy