Sponsored Content
Homework and Emergencies Homework & Coursework Questions Help with using different types of GREP Post 302576622 by SilvarHawke on Friday 25th of November 2011 10:44:27 AM
Old 11-25-2011
Well if its alright then I may as well as them. I'm curently working through the same worksheet only I have moved onto advanced grep, and there are two questions in it that have me puzzled. Here they are.

Quote:
j) Find out which models of car do NOT contain a digit within their name. Where (line position) within the file are the cars which do have digits within their model name?

m) Find any car model names which include “ee”, without explicitly including “ee”
within your search pattern. Hint: Use curly { } brackets

n) Find out all car models beginning with “B”, and redirect these to a file called
“alpha-carslist.txt”. Append to this file, all car models beginning with “C”. How
many records are in the above file? (Hint: use the “wc -l” command)
And just to show you the layout of how the car list looks like, here are the first few lines, not all of them just in case it seems like too much.

Quote:
Ford:Mondeo:1997:Blue:5
Vauxhall:Vectra:1999:White:2
Seat:Ibiza:1996:Red:4
Peugeot:406:1999:Silver:1
McLaren:F1:1997:Black:2
Skoda:Octavia:2003:Silver:2
Peugeot:206:2000:Red:1
Even with the hints for m & n I'm still having trouble with what comands I should be using, all I know is that I have been using a format such as this for the most recent questions and answers.

Quote:
cat carslist.txt | grep '.*:.*:.*:.*:.*$'
or something similar anyway. Some more help on these would be greatfully appreciated. =-)
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

backup types

can anyone explain me difference between tar and ufsdump commands.............and also i wd like to know the difference between incremental and differential backup......... thx in advance (1 Reply)
Discussion started by: girish_shukla
1 Replies

2. UNIX for Dummies Questions & Answers

Two types of pipes?

What is the difference between: cd /tmp tar -cf - *.txt |gzip > tmp_txt.tar.gz and cd /tmp mknod pipe p gzip < pipe > /tmp/tmp_txt1.tar.gz & tar -cf pipe *.txt Apart from the fact that we have to create the pipe file manually, is there any difference in the performance of the two?... (5 Replies)
Discussion started by: blowtorch
5 Replies

3. UNIX for Dummies Questions & Answers

mime types

Hi, I am trying to launch an ogg movie from a pdf file which has been produced with pdflatex and \movie {\centerline{\includegraphics {grafiques_xerrades/un_manolo_amb_camera.pdf}}} {hlims_xerrades/XocCumuls.ogg} The switch "externalviewer" makes kpdf launch the default... (5 Replies)
Discussion started by: pau
5 Replies

4. UNIX for Dummies Questions & Answers

How do I grep in specific file types?

I have a directory with file types ending .log, .mml, .gll, .dll . How can I grep expressions only in say the .log files? (3 Replies)
Discussion started by: bbbngowc
3 Replies

5. Programming

enumeration types in C

If I want to declare an array of structures in C and have the number of items in that array to correspond to the items of an enumeration, is there a way to access the maximum value in the enumeration when declaring the array? For instance: typedef struct { various fields.... } ... (3 Replies)
Discussion started by: cleopard
3 Replies

6. What is on Your Mind?

What Types of Food Do You Like The Most?

On another simple topic, multiple choice answers OK ( you can pick more than one or suggest others - we will add your suggestions to the poll ). What Types of Food Do You Like The Most? (27 Replies)
Discussion started by: Neo
27 Replies

7. Shell Programming and Scripting

Cp -r except certain file types

the following excludes certain directories successfully cp -r probe/!(dir) /destination I want to exclude certain file types and tried unsuccessfully cp -r probe/!(*.avi) /destination (2 Replies)
Discussion started by: tmf
2 Replies

8. UNIX for Advanced & Expert Users

Recursive grep with only certain types of files

Can I please have some ideas on how to do a recursive grep with certain types of files? The file types I want to use are *.c and *.java. I know this normally works with all files. grep -riI 'scanner' /home/bob/ 2>/dev/null Just not sure how to get it to work *.c and *.java files. (5 Replies)
Discussion started by: cokedude
5 Replies
Gnome2::GConf::Value(3pm)				User Contributed Perl Documentation				 Gnome2::GConf::Value(3pm)

NAME
Gnome2::GConf::Value - Opaque datatype for generic values SYNOPSIS
$client = Gnome2::GConf::Client->get_default; $client->set($config_key, { type => 'string', value => 'Hello, World', }); print "The Meaning of Life." if ($client->get($another_key)->{value} == 42); DESCRIPTION
"GConfValue" is a dynamic type similar to "GValue", and represents a value that can be obtained from or stored in the configuration database; it contains the value bound to a key, and its type. In perl, it's an hashref containing these keys: type The type of the data. Fundamental types are 'string', 'int', 'float' and 'bool'. Lists are handled by passing an arrayref as the payload of the "value" key: $client->set($key, { type => 'string', value => 'some string' }); $client->set($key, { type => 'float', value => 0.5 }); $client->set($key, { type => 'bool', value => FALSE }); $client->set($key, { type => 'int', value => [0..15] }); Pairs are handled by using the special type 'pair', and passing, in place of the "value" key, the "car" and the "cdr" keys, each containing an hashref representing a GConfValue: $client->set($key, { type => 'pair', car => { type => 'string', value => 'some string' }, cdr => { type => 'int', value => 42 }, }); This is needed since pairs might have different types; lists, instead, are of the same type. value The payload, containing the value of type "type". It is used only for fundamental types (scalars or lists). car, cdr Special keys, that must be used only when working with the 'pair' type. SEE ALSO
Gnome2::GConf(3pm), Gnome2::GConf::Entry(3pm), Gnome2::GConf::Schema(3pm), Gnome2::GConf::ChangeSet(3pm). METHODS
integer = $value_a->compare ($value_b) o $value_b (value) Since: gconf 2.13 string = $value->to_string SEE ALSO
Gnome2::GConf COPYRIGHT
Copyright (C) 2003-2006 by the gtk2-perl team. This software is licensed under the LGPL. See Gnome2::GConf for a full notice. perl v5.14.2 2011-11-17 Gnome2::GConf::Value(3pm)
All times are GMT -4. The time now is 06:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy