Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Awk/sed solution for grep,cut Post 302334962 by priyam on Friday 17th of July 2009 01:24:29 AM
Old 07-17-2009
Quote:
Originally Posted by rakeshawasthi
hmm, works for me. May be depends on the version of awk.
Code:
$ cat example
SUB: ENG123, GROUP 1
SUB: HIS124, GROUP 1
$ cat ex.sh
awk '/ENG/ {$0=$2;FS="[A-Z,]";print $(NF-1)}' example
$ sh ex.sh
123
$

Think you are right about the version.
Code:
>awk '/ENG/ {$0=$2;FS="[A-Z,]";print $(NF-1)}' ~/eg
ENG123,

Anyways , thanks for the help.
-- Priya
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed, grep, cut or combine?

I am a beginner at shell scripting, actually i am working on my first script right now. Anyway i have searched the world how to grep two letters from each word (it will always just be two words). For example: Example Blablabla I want my script to cut out Ex (from the first word) and Bl... (4 Replies)
Discussion started by: maskot
4 Replies

2. Shell Programming and Scripting

cut sed grep or other?

Hi Is there a way to cut the last two characters off a word or number given that this word or number can be of varying length? I have tried something like TEST=`echo $OLD | cut -c 1-5` where $OLD is a variable containing a number like 1234567 which gives a result of 12345. This is fine... (4 Replies)
Discussion started by: rleebife
4 Replies

3. Shell Programming and Scripting

Sed Awk Cut Grep Combination Help ?

I have been reading for a few hours trying to educate myself enough to accomplish this task, so please know I have performed some research. Unfortunately, I am not a *NIX scripting expert, or a coder. I come from a network background instead. SO, here is my desired outcome. I have some Cisco... (5 Replies)
Discussion started by: abbzer0
5 Replies

4. Shell Programming and Scripting

Using grep and cut within awk

Hi My input file looks like as follows: say a.txt "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss... (5 Replies)
Discussion started by: bittoo
5 Replies

5. Shell Programming and Scripting

GREP/CUT/AWK to Arrays

hi people, I have a text file containing data, seperated by TAB. I want to process this tab'ed data as variable. how can I assign this? Ex: Code: 11aaa 12000 13aaa 14aaa 15aaa 16aaa 17aaa 21aaa 22000 23aaa 24aaa 25aaa 26aaa 27aaa 31aaa 32000 33aaa 34aaa 35aaa 36aaa 37aaa... (1 Reply)
Discussion started by: gc_sw
1 Replies

6. Shell Programming and Scripting

Using a combination of sort/cut/grep/awk/join/paste/sed

I have a file and need to only select users that have a shell of “/bin/bash” in the line using awk or sed please help (4 Replies)
Discussion started by: boyboy1212
4 Replies

7. Shell Programming and Scripting

AWK or SED solution

Hello. I have big file data like this(part of file): .... 18210102021010000110 47401000000 021001 5166891.16 021011 5166891.16 18210602010020000110 47401000000 020701 8995421.00 021001 8995421.00 021011 8995421.00 030801 .08 18210604011020000110 47401000000 020701 9048.00 021001... (3 Replies)
Discussion started by: maxoff
3 Replies

8. UNIX for Dummies Questions & Answers

Print/cut/grep/sed/ date yyyymmdd on the filename only.

I have this filename "RBD_EXTRACT_a3468_d20131118.tar.gz" and I would like print out the "yyyymmdd" only. I use this command below, but if different command like cut or print....etc. Thanks ls RBD_EXTRACT* | sed 's/.*\(........\).tar.gz$/\1/' > test.txt (9 Replies)
Discussion started by: dotran
9 Replies

9. Shell Programming and Scripting

sed or awk Solution

Hi I am having a csv file like this ahsh,90.82,add,32424,ahha hhdh,98.89,hdhdh,92728,neha hshs,you,97.7,hdhdhd,are,a jsjsj,wonderful,9788,79.9,aheh ahdh,95.5,girl, 2737,jolllI need to add width="100" to the value which is greater than 90 like decimal points but less than 100 Output... (5 Replies)
Discussion started by: kshitij
5 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 05:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy