Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Complex Pipeline/Redirection/Regular Expression problem Post 90924 by netmaster on Monday 28th of November 2005 11:33:43 PM
Old 11-29-2005
Complex Pipeline/Redirection/Regular Expression problem

This is a very hard unix command which I could not perform..... Smilie ......here it is:


The file ~unx122/public/data.txt contains over 18,000 lines of text. Here are the first ten lines of the file:

pagination 20657 2740 28416 31090 18145

shiner 1695 2507 9964 14512 13122

cool 29210 23832 22861 25037 18722

entertain 16186 23873 5049 3781 15735

sandwiches 9407 61 10817 7342 18224

sustenance 27174 8344 331 18238 25000

humanitarian 29733 13594 5573 24760 20213

Gus 10371 20643 22256 28933 7187

promoting 24678 31046 5759 7005 29626

ethereal 4963 15542 12202 23911 31595


Each line contains a word and five numbers, each separated by spaces. There are no spaces or punctuation marks in any of the words; each word consists of only upper- and lower-case letters. All of the numbers are whole numbers (no decimals and no negative numbers). There are no leading zeros (extra zeros added to the start of the numbers).

*****************************************************

From the file ~unx122/public/data.txt, select all of the lines that
have a word in column one that starts and ends with vowels
and have values between 1000 and 9999 in the third column.

Sort these lines in reverse order according to column 3, then
select lines 15 through 37. Finally, put these lines in
normal order according to column 1 and write them to the file
~/uli101_a2_output.txt (overwrite any data already in that file).

Create a command pipeline to perform this task. In the file ~/uli101_assignment2, place an appropriate bash shebang line, then your command pipeline.


Definitions

Here are the definitions of some of the terms used in the problem description:

Vowel - one of the letters: a, e, i, o, or u.

Consonant - any letter that is not a vowel.

Character - any letter,number, digit, space, or punctuation character.

Upper-Case - CAPITAL LETTERS

Lower-Case - non-capital letters

Odd digit - one of these digits: 1, 3, 5, 7, or 9.

Even digit - one of these digits: 0, 2, 4, 6, or 8.

Odd number - A number which is not evenly divisible by 2 (a number
ending in an odd digit).

Even number - A number which is evenly divisible by 2 (a number
ending in an even digit).

Normal order - Ascending order (lowest to highest value).
Use a numeric sort for numbers, or an ASCII sort for text.

Reverse order - Descending order (highest to lowest value).
Use a numeric sort for numbers, or an ASCII sort for text.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Regular Expression Problem

Display all of the lines in a file that contain "Raspberry" followed later in the line by the letter "a" I tried: grep Raspberry*a filename that didn't work Anyone know a solution? (1 Reply)
Discussion started by: netmaster
1 Replies

2. Shell Programming and Scripting

Regular Expression problem

Hi guys I've been trying to write a regular expression. If I'm tryin to validate a sequence of characters as follows... AB1-232-623482-743 43/3 where a) any character after the "AB" can be any alphanumeric character b) the " 43/3" part is optional is there a quick neat way for me... (5 Replies)
Discussion started by: djkane
5 Replies

3. UNIX for Dummies Questions & Answers

Regular Expression Problem

this is how my xyz.log file loooks like :- info ( 816): CORE1116: Sun ONE Web Server 6.1SP5 B08/17/2005 22:09 info ( 817): CORE5076: Using from info ( 817): WEB0100: Loading web module in virtual server at info ( 817): WEB0100: Loading web module in virtual server at perl... (12 Replies)
Discussion started by: chris1234
12 Replies

4. Shell Programming and Scripting

Double Spacing complex sed pipeline

my script: FILE="$1" echo "You Entered $FILE" if ; then tmp=$(cat $FILE | sed '/./!d' | sed -n '/regex/,/regex/{/regex/d;p}'| sed -n '/---/,+2!p' | sed -n '/#/!p' | sed 's/^*//' | sed -e\ s/*:// | sed -n '/==> /!p' | sed -n '/--> /!p' | sed -n '/regex/,+1!p' | sed -n '/======/!p' | sed -n... (1 Reply)
Discussion started by: omgsomuchppl
1 Replies

5. Shell Programming and Scripting

New line problem of regular expression

could anybody tell me how i can add/append a new line using regular expression in vi on AIX? i've tried several ways before, but all of them failed. e.g. :%s/$/\n/ :%s/^/\v\r/ :( (1 Reply)
Discussion started by: wrl
1 Replies

6. Shell Programming and Scripting

Problem with a regular expression

Hello! I'm working with AWK, and i have this code: /<LOOP_TIME>/,/<\/LOOP_TIME>/ I want that match every everything between <LOOP_TIME> and </LOOP_TIME>, but not if the line have a "#" before the tags. Someone can help me? Thanks! (6 Replies)
Discussion started by: claw82
6 Replies

7. Shell Programming and Scripting

Problem with regular expression

Witam, mam oto taki ciąg znaków: 8275610268 + 9012383215 =niepotrzebnytextPotrzebuję w bash'u wyciągnąć obie liczby (mają taką samą liczbę cyfr), zapisać je do osobnych zmiennych, ale coś nie idzie, kombinowałem z grepem, ale nie potrafię skleić tego wyrażenia regularnego, no i potem przypisać do... (7 Replies)
Discussion started by: menda90
7 Replies

8. Shell Programming and Scripting

SED (regular expression) problem ---

Hello, I would like to replace Line 187 of my file named run_example. The original line is below, including the spaces: celldm(1) = 6.00, I want it to become something like celldm(1) = 6.05, or celldm(1) = 6.10, where the number is stored in a variable called... (6 Replies)
Discussion started by: bluesmodular
6 Replies

9. Shell Programming and Scripting

Regular Expression problem

I have two input files (given below) and to compare each line of the File1 with each line of File2 starts with '>sample1'. If a match occurs and that matched line in the File2 contains another line or sequence of lines starting with "Chr" they have to be displayed in output file with that sample.... (8 Replies)
Discussion started by: hravisankar
8 Replies

10. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies
CheckDigits::M43_001(3pm)				User Contributed Perl Documentation				 CheckDigits::M43_001(3pm)

NAME
CheckDigits::M43_001 - compute check digits for Code-39 SYNOPSIS
use Algorithm::CheckDigits; $c39 = CheckDigits('code_39'); if ($c39->is_valid('AB-123K')) { # do something } $cn = $c39->complete('AB-123'); # $cn = 'AB-123K' $cd = $c39->checkdigit('AB-123K'); # $cd = 'K' $bn = $c39->basenumber('AB-123K'); # $bn = 'AB-123' DESCRIPTION
ALGORITHM 1. After replacing all non numeric letters with their respective values, the sum of all numbers is computers 2. The checkdigit is the sum from step 1 taken modulo 43. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. perl v5.10.0 2008-05-17 CheckDigits::M43_001(3pm)
All times are GMT -4. The time now is 12:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy