Sponsored Content
Top Forums Shell Programming and Scripting awk - need to remove unwanted newlines on match Post 302345148 by Franklin52 on Tuesday 18th of August 2009 02:08:26 PM
Old 08-18-2009
Quote:
Originally Posted by Bubnoff
As a bit of an aside:
Is there a better way to describe the regex above ...i.e. without the --posix
option?

Bub
Use:

Code:
if ($1 >= 100000 && $1 < 1000000)

instead of:

Code:
if(/^[0-9]{6}/)

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove improperly placed newlines

Hello, there. I have a file that's a horrible, horrible mess. (Basically, it's an export from a firewall config.) The people who generated the file didn't think that putting a newline in the middle of a hostname would ever be a problem. It is. Here's an example of the stuff in the file: ... (2 Replies)
Discussion started by: mikesimone
2 Replies

2. Shell Programming and Scripting

perl regexp: no match across newlines

Hi. Here's a tricky one (at least to me): I have a file named theFile.txt (UTF-8) that contains the following: a b cWhen I execute perl -pe 's|a.*c|d|sg' theFile.txtin bash 3.2 on MAC OS X 10.6, I get no match, i.e. the result is a b cagain. Any clues why? (2 Replies)
Discussion started by: BatManWSL
2 Replies

3. Shell Programming and Scripting

sed remove newlines and spaces

Hi all, i am getting count from oracle 11g by spooling it to a file. Now there are some newline characters and blank spaces i need to remove these. pl provide me a awk/sed solution. the spooled file is attached. i tried this.. but not getting req o/p (6 Replies)
Discussion started by: rishav
6 Replies

4. Shell Programming and Scripting

How to remove unwanted strings?

Hi Guys, Can someone give me a hand on how I can remove unwanted strings like "<Number>" and "</Number>" and retain only the numbers from the input file below. INPUT FILE: <Number>10050000</Number> <Number>1001340001</Number> <Number>1001750002</Number> <Number>100750003</Number>... (8 Replies)
Discussion started by: pinpe
8 Replies

5. Shell Programming and Scripting

Awk-sed help : to remove first and last line with pattern match:

awk , sed Experts, I want to remove first and last line after pattern match "vg" : I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data. - So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Discussion started by: rveri
5 Replies

6. UNIX for Dummies Questions & Answers

Remove newlines

Hi buddy's my file are like this: s.no,name,band,sal 1,"suneel",,10 2,"bargav sand",,20 30," ebdug gil",,4 but i want s.no,name,band,sal 1,"suneel",,10 2,"bargav sand",,20 30,"ebdug gil",,4 any command or Shell script for this. please help me it's urgent to implement (33 Replies)
Discussion started by: Suneelbabu.etl
33 Replies

7. UNIX for Dummies Questions & Answers

Using find with awk to remove newlines

I want to list all html files present in a directory tree, the remove the newline and get one string with a space between files find /home/chrisd/Desktop/seg/geohtml/ -name '*.html' | awk BEGIN{FS=\r} '{print}' ---------- Post updated at 06:47 PM ---------- Previous update was at 06:25 PM... (5 Replies)
Discussion started by: kristinu
5 Replies

8. Shell Programming and Scripting

Awk; pattern match, remove and re write

the following pattern match works correctly for me awk '/name="Fruits"/{f=1;next} /"name=Vegetables"/{f=0} f' filename This works well for me. Id like to temporarily move the match out of the file ( > newfile) and be able to stick it back in the same place at a later time. Is this... (7 Replies)
Discussion started by: TY718
7 Replies

9. Shell Programming and Scripting

awk to remove field and match strings to add text

In file1 field $18 is removed.... column header is "Otherinfo", then each line in file1 is used to search file2 for a match. When a match is found the last four strings in file2 are copied to file1. Maybe: cut -f1-17 file1 and then match each line to file2 file1 Chr Start End ... (6 Replies)
Discussion started by: cmccabe
6 Replies

10. Shell Programming and Scripting

Using awk to remove lines from file that match text

I am trying to remove each line in which $2 is FP or RFP. I believe the below will remove one instance but not both. Thank you :). file 12 123 FP 11 10 RFP awk awk -F'\t' ' $2 != "FP"' file desired output 12 11 (6 Replies)
Discussion started by: cmccabe
6 Replies
lpinfo(8)							    Apple Inc.								 lpinfo(8)

NAME
lpinfo - show available devices or drivers SYNOPSIS
lpinfo [ -E ] [ -U username ] [ -h server[:port] ] [ -l ] [ --device-id device-id-string ] [ --exclude-schemes scheme-list ] [ --include- schemes scheme-list ] [ --language locale ] [ --make-and-model name ] [ --product name ] -m lpinfo [ -E ] [ -U username ] [ -h server[:port] ] [ -l ] [ --exclude-schemes scheme-list ] [ --include-schemes scheme-list ] [ --timeout seconds ] -v DESCRIPTION
lpinfo lists the available devices or drivers known to the CUPS server. The first form (-m) lists the available drivers, while the second form (-v) lists the available devices. OPTIONS
lpinfo accepts the following options: -E Forces encryption when connecting to the server. -U username Sets the username to use when connecting to the server. -h server[:port] Selects an alternate server. -l Shows a "long" listing of devices or drivers. --device-id device-id-string Specifies the IEEE-1284 device ID to match when listing drivers with the -m option. --exclude-schemes scheme-list Specifies a comma-separated list of device or PPD schemes that should be excluded from the results. Static PPD files use the "file" scheme. --include-schemes scheme-list Specifies a comma-separated list of device or PPD schemes that should be included in the results. Static PPD files use the "file" scheme. --language locale Specifies the language to match when listing drivers with the -m option. --make-and-model name Specifies the make and model to match when listing drivers with the -m option. --product name Specifies the product to match when listing drivers with the -m option. --timeout seconds Specifies the timeout when listing devices with the -v option. COMPATIBILITY
The lpinfo command is unique to CUPS. SEE ALSO
lpadmin(8), http://localhost:631/help COPYRIGHT
Copyright 2007-2011 by Apple Inc. 5 December 2008 CUPS lpinfo(8)
All times are GMT -4. The time now is 04:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy