Sponsored Content
Top Forums Shell Programming and Scripting awk Quick Help: printing upto 3rd octet . Post 302771165 by rveri on Tuesday 19th of February 2013 10:59:56 PM
Old 02-19-2013
bipinajith,
This worked great,
could you please explain a bit this portion , I am unable to unerstand how you got the 3 octet only outof 4 + ":" , with the
Code:
sub(/\.[0-9]+:.*/,x,$4);

Thanks,

---------- Post updated at 10:59 PM ---------- Previous update was at 10:54 PM ----------

Ok got it , that means the 4rth octet and remaining part of $4 substitured with x , that means with nothing value assigned to x, so $4 keeps upto 3rd octet only. Good one. Thanks.
This User Gave Thanks to rveri For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

printing 3rd or 4th feild from last in awk.

Whats up fellas... hope someone can help me with the following... I am parsing an file that is space delimited, however, in the middle, there is an ugly "Account Name" feild that in itself has multiple varying spaces, and commas which throws off my script. The 1st 3 feilds I am able to obtain... (8 Replies)
Discussion started by: djsal
8 Replies

2. Shell Programming and Scripting

Help with AWK -- quick question

Ok. I'm just starting to use AWK and I have a question. Here's what I'm trying to do: uname -n returns the following on my box: ftsdt-svsi20.si.sandbox.com I want to pipe this to an AWK statement and make it only print: svsi20 I tried: uname -n | awk '{ FS = "." ; print $1 }' ... (5 Replies)
Discussion started by: Probos
5 Replies

3. UNIX and Linux Applications

Any idea on 3 Octet IP address ?

Hi All, I found my weblog contain entries like 121.23.3 Instead of four octet. I am quite confused is it possible to have 3 octet ip at all ?? Is it generating by any program and hittng the website ? Is it a subdomain ? Please tell me your understanding on it ? Thanks (4 Replies)
Discussion started by: jambesh
4 Replies

4. UNIX for Dummies Questions & Answers

Quick egrep / awk help, Please

Ok, this may be very simple but I can't find a solution. I have a list of numbered values which I have grepped from a larger life. ex/ 1:7.54 2:4.52 3:3.22 4:2.11 5:3.59 6:4.36 7:6.88 8:12.28 9:13.37 10:15.6 11:17.66 12:14.25 I need a quick way to organize them (using awk?)... (4 Replies)
Discussion started by: jdolny
4 Replies

5. Shell Programming and Scripting

Quick help on 'awk' needed...!!

bash-2.05$ A=`cat /etc/group |awk -F':' '{if ($1$3$4 ==... (3 Replies)
Discussion started by: ak835
3 Replies

6. Shell Programming and Scripting

Quick awk tip :)

how do i "awk" the date after the from only to compare it on a if statement later . filename example: server1-ips-ultranoob-ok_From_2012_21_12-23:40:23_To_2012_21_12-23:49:45.zip what i want o do is compare only the date from the string in "From_2012_21_12" in this case i only want the... (4 Replies)
Discussion started by: drd0spt
4 Replies

7. Shell Programming and Scripting

Awk: Help with how to remove 4rth octet :

Experts, In one example I have seen how to get output upto 3rd octet, when there is a ":" separated with the 4rth octet. However in this example how to remove 4rth octet and to keep upto 3rd octet with regular expressions and awk sub function: I have tried with :but not working: # awk '{... (3 Replies)
Discussion started by: rveri
3 Replies

8. Shell Programming and Scripting

Quick awk question

gawk 'BEGIN{count=0} /^Jan 5 04:33/,0 && /fail/ && /09x83377/ { count++ } END { print count }' /var/log/syslog what is wrong with this code? i want to search the strings "fail" and "09x83377" from all entries. im grabbing all entries in the log starting from Jan 5 04:33 to the end of the... (3 Replies)
Discussion started by: SkySmart
3 Replies
IMAGE_TYPE_TO_MIME_TYPE(3)						 1						IMAGE_TYPE_TO_MIME_TYPE(3)

image_type_to_mime_type - Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype

SYNOPSIS
string image_type_to_mime_type (int $imagetype) DESCRIPTION
The image_type_to_mime_type(3) function will determine the Mime-Type for an IMAGETYPE constant. PARAMETERS
o $imagetype - One of the IMAGETYPE_XXX constants. RETURN VALUES
The returned values are as follows Returned values Constants +----------------------------------------+-------------------------------+ | $imagetype | | | | | | | Returned value | | | | +----------------------------------------+-------------------------------+ | | | | IMAGETYPE_GIF | | | | | | | | | | image/gif | | | | | | | | IMAGETYPE_JPEG | | | | | | | | | | image/jpeg | | | | | | | | IMAGETYPE_PNG | | | | | | | | | | image/png | | | | | | | | IMAGETYPE_SWF | | | | | | | | | | application/x-shockwave-flash | | | | | | | | IMAGETYPE_PSD | | | | | | | | | | image/psd | | | | | | | | IMAGETYPE_BMP | | | | | | | | | | image/bmp | | | | | | | | IMAGETYPE_TIFF_II (intel byte order) | | | | | | | | | | image/tiff | | | | | | | |IMAGETYPE_TIFF_MM (motorola byte order) | | | | | | | | | | image/tiff | | | | | | | | IMAGETYPE_JPC | | | | | | | | | | application/octet-stream | | | | | | | | IMAGETYPE_JP2 | | | | | | | | | | image/jp2 | | | | | | | | IMAGETYPE_JPX | | | | | | | | | | application/octet-stream | | | | | | | | IMAGETYPE_JB2 | | | | | | | | | | application/octet-stream | | | | | | | | IMAGETYPE_SWC | | | | | | | | | | application/x-shockwave-flash | | | | | | | | IMAGETYPE_IFF | | | | | | | | | | image/iff | | | | | | | | IMAGETYPE_WBMP | | | | | | | | | | image/vnd.wap.wbmp | | | | | | | | IMAGETYPE_XBM | | | | | | | | | | image/xbm | | | | | | | | IMAGETYPE_ICO | | | | | | | | | | image/vnd.microsoft.icon | | | | +----------------------------------------+-------------------------------+ EXAMPLES
Example #1 image_type_to_mime_type(3) example <?php header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG)); ?> NOTES
Note This function does not require the GD image library. SEE ALSO
getimagesize(3), exif_imagetype(3), exif_read_data(3), exif_thumbnail(3). PHP Documentation Group IMAGE_TYPE_TO_MIME_TYPE(3)
All times are GMT -4. The time now is 11:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy