Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Awk pattern with letters and forward slash Post 302604133 by francy.casa on Saturday 3rd of March 2012 08:50:18 AM
Old 03-03-2012
Thank you very much Scott! I was making it more complicated with useless curly brackets. Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep for forward slash

How can I use grep to grab a line that contains a forward slash? I've tried: grep "/pd " file, Inevitably it just grabs pd not /pd. (3 Replies)
Discussion started by: wxornot
3 Replies

2. Shell Programming and Scripting

Help with SED and forward slash

Using the script: (Called replaceit) #!/bin/ksh String=$1 Replace=$2 sed -e "s/${orig}/${new}/g" oldfile.txt > newfile.txt In oldfile.txt, I'm looking for: getenv("Work") And change it To: /u/web I execute the script: replaceit "getenv(\""Work\"")" /u/web I'm getting sed... (3 Replies)
Discussion started by: gseyforth
3 Replies

3. Shell Programming and Scripting

escaping / (forward slash)

how to escape / (forward slash) in a string. I have following scnerio: sed s/${var1}{$var2} var1 and var2 both contain slashes, but sed gives error if there is a slash in var1 or var2. sed is used here to replace var1 with var2. Thanks in advance (1 Reply)
Discussion started by: farooqpervaiz
1 Replies

4. Shell Programming and Scripting

Using sed to append backward slash before forward slash

Hi all, I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
Discussion started by: sarbjit
2 Replies

5. Shell Programming and Scripting

Significance of forward slash(/) while specifying a directory

What is the significance of the forward slash(/) while specifying a directory? cp -av /dir/ /opt/ and cp -av /dir /opt Does effectively the same job it seems? (2 Replies)
Discussion started by: proactiveaditya
2 Replies

6. UNIX for Dummies Questions & Answers

Replace Forward Slash with sed

i need to replace '/' forward slash with \/(backward slash follwed by a forward slash) using sed command when the forward slash occurs as a first character in a file.. Tried something like this but doesn't seem to work. find $1 -print0 | xargs -0 sed -i -e 's/^\//\\\//g' Can someone... (19 Replies)
Discussion started by: depakjan
19 Replies

7. Shell Programming and Scripting

AWK or SED to replace forward slash

hi hope somebody can help, there seems to be bit on the net about this, but still cant make it work the way i need. i have a file live this mm dd ff /dev/name1 mm dd ff /dev/name2 mm dd ff /dev/name3 mm dd ff /dev/name4 i need to update /dev/name1 etc to /newdev/new/name1 etc so... (5 Replies)
Discussion started by: dshakey
5 Replies

8. UNIX for Dummies Questions & Answers

Issues with sort and forward slash

I have some directories I am trying to sort. When I attempt to sort them and they are in this format, everything works great: file /vol/trees10 /vol/trees2 /vol/trees7 cat file |sort -ts -k2 -n /vol/trees2 /vol/trees7 /vol/trees10 This makes thefiles in the order... (9 Replies)
Discussion started by: newbie2010
9 Replies

9. UNIX for Beginners Questions & Answers

Using forward slash in search pattern in perl script

I have existing pattern in the perl script as: my $pattern = "^Line.*?:|^Errors*: |^SEVERE:.*?:|^Null pointer exception occurred"; and I wanted to include below keywords in my search pattern "I/O exception" and "FileNotFoundException"the problem is when I include my pattern like my... (5 Replies)
Discussion started by: ambarginni
5 Replies

10. Shell Programming and Scripting

Escaping Forward Slash

./split2.sh: line 1: split/ssl/pop3s.txt: No such file or directory sort: cannot read: split/ssl/pop3s.txt: No such file or directory Hi there, I am pulling data from the following source: ssl/http ssl/http ssl/http-alt ssl/https ssl/https ssl/https ssl/https ssl/https ssl/https... (3 Replies)
Discussion started by: alvinoo
3 Replies
MongoDB::OID(3pm)					User Contributed Perl Documentation					 MongoDB::OID(3pm)

NAME
MongoDB::OID - A Mongo ObjectId SYNOPSIS
If no "_id" field is provided when a document is inserted into the database, an "_id" field will be added with a new "MongoDB::OID" as its value. my $id = $collection->insert({'name' => 'Alice', age => 20}); $id will be a "MongoDB::OID" that can be used to retreive or update the saved document: $collection->update({_id => $id}, {'age' => {'$inc' => 1}}); # now Alice is 21 To create a copy of an existing OID, you must set the value attribute in the constructor. For example: my $id1 = MongoDB::OID->new; my $id2 = MongoDB::OID->new(value => $id1->value); Now $id1 and $id2 will have the same value. Warning: at the moment, OID generation is not thread safe. SEE ALSO
Core documentation on object ids: <http://dochub.mongodb.org/core/objectids>. ATTRIBUTES
value The OID value. A random value will be generated if none exists already. It is a 24-character hexidecimal string (12 bytes). Its string representation is the 24-character string. METHODS
to_string my $hex = $oid->to_string; Gets the value of this OID as a 24-digit hexidecimal string. get_time my $date = DateTime->from_epoch(epoch => $id->get_time); Each OID contains a 4 bytes timestamp from when it was created. This method extracts the timestamp. TO_JSON my $json = JSON->new; $json->allow_blessed; $json->convert_blessed; $json->encode(MongoDB::OID->new); Returns a JSON string for this OID. This is compatible with the strict JSON representation used by MongoDB, that is, an OID with the value "012345678901234567890123" will be represented as "{"$oid" : "012345678901234567890123"}". AUTHOR
Kristina Chodorow <kristina@mongodb.org> perl v5.14.2 2011-09-07 MongoDB::OID(3pm)
All times are GMT -4. The time now is 11:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy