Sponsored Content
Full Discussion: AWK Restrictive Search
Top Forums Shell Programming and Scripting AWK Restrictive Search Post 302667677 by metallica1973 on Friday 6th of July 2012 05:16:06 PM
Old 07-06-2012
Thank you for you reply but it did not work.

Code:
cat wspasswd | awk -F: 'tolower($1) ~ /^testaccount2/{for(i=1;i<=NF;i++){if($i ~ /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/) print $i}}'

it prints nothing.

---------- Post updated at 05:16 PM ---------- Previous update was at 04:35 PM ----------

Code:
awk -F ':' 'tolower($1) ~ /^testaccount2/ { for ( i = 1; i <= NF; i++ ) { if ( $i ~ /[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/ ) print $i } }' wspasswd

This did many many thanks.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Restrictive mail implementation problem

Any tips on this problem will be greatly appreciated. I need to build a Linux mailserver, that needs to meet the following requirements: 3 usergroups: endusers, supervisors, and management Endusers will be on a local Linux mailserver Supervisors and management will be on Google Apps ... (0 Replies)
Discussion started by: zefflyn
0 Replies

2. Shell Programming and Scripting

awk search

i guys, i have a bash script , and it works, but i need an awk file, and i can't convert this code like: #!/bin/awk -f ..... my script #!/bin/bash awk '/\<FIRST\>|\<SECOND\>|\<THIRD\>|\<ZERO\>/' DOC.txt thanks :) (4 Replies)
Discussion started by: felito
4 Replies

3. Shell Programming and Scripting

awk search if else

Hi, I want to search for a particular string using awk and print "Found" or "Not Found" depending on the search. On searching this forum i got this code but it is not working: (6 Replies)
Discussion started by: rishav
6 Replies

4. UNIX for Dummies Questions & Answers

Awk search help

Hi, Want to know what does it returns. $ awk '$1 == /Jan/' inv $ awk '$1 = /Jan/' inv --- What does this one signify. 1 13 25 15 115 1 21 36 64 620 $ awk '$1 ~ /Jan/' inv Jan 13 25 15 115 Jan 21 36 64 620 Thanks in advance. (3 Replies)
Discussion started by: vanand420
3 Replies

5. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

6. Shell Programming and Scripting

Search and replace with awk

Hi Shell Tigers, I am trying to acheive search and replace strings within a setup file. Help much appreciated. test.setup ORACLE_HOME=/oracle/product/11.0.0/home01 PATH1=/perm_loc/3222/FTP/cfg1 PATH2=/perm_loc/3222/FTP/cfg2/bin PATH3=/perm_loc/3222/FTP/cfg3/bin So... (3 Replies)
Discussion started by: jville
3 Replies

7. Shell Programming and Scripting

awk variable search and line count between variable-search pattern

Input: |Running the Rsync|Sun Oct 16 22:48:01 BST 2016 |End of the Rsync|Sun Oct 16 22:49:54 BST 2016 |Running the Rsync|Sun Oct 16 22:54:01 BST 2016 |End of the Rsync|Sun Oct 16 22:55:45 BST 2016 |Running the Rsync|Sun Oct 16 23:00:02 BST 2016 |End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)
Discussion started by: busyboy
4 Replies

8. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies

9. Post Here to Contact Site Administrators and Moderators

Restriction of adding links is too restrictive

I am trying to write a shell script that generates links to a website. Not to spam it. The code necessarily adds things that are links, and so get rejected. In the end I have up, and have not written the post. Whilst I apprecaite you want to avoid spam, could you not implement something so... (1 Reply)
Discussion started by: drkirkby
1 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 04:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy