Sponsored Content
Full Discussion: Quick awk tip :)
Top Forums Shell Programming and Scripting Quick awk tip :) Post 302734029 by drd0spt on Wednesday 21st of November 2012 11:39:38 AM
Old 11-21-2012
Tools Quick awk tip :)

how do i "awk" the date after the from only to compare it on a if statement later .

filename example:
Code:
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 "2012_21_22"

and make the if comparison but i got that cover Smilie

Tnx guys .Smilie
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

quick check of my awk syntax

I've made an awk command that works successfully. However I'd like to add one character to it. For example instead of /what_i_have_now/ I'd like to change just ONE field to the opposite with an exclamation point. Like this: ! /what_i_have_now/ My question, where am I supposed to place... (1 Reply)
Discussion started by: yongho
1 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 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

4. 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

5. Shell Programming and Scripting

Quick sed/awk question

Hi fellow linux-ers, I have a quick question for you. I have the following text, which I would like to modify: 10 121E(121) 16 Jan 34S 132E 24 Feb 42 176E(176) 18 Sep 21S 164E 25 May 15 171W(-171) 09 Jul How can I do the following 2 modifications using sed and/or awk? 1. in 1st column,... (1 Reply)
Discussion started by: lucshi09
1 Replies

6. Shell Programming and Scripting

awk Quick Help: printing upto 3rd octet .

Hi Experts, I am trying to print $2 & the IP_address upto 3rd octet only. But unable to do so, Trying # awk '{print $2, substr($4,1,9)}' file . but not correct File: HOST= cmiHOST06 :: 10.26.107.73:/data120 /nbu/cmiHOST06/athpx07/aa1 HOST= cmiHOST05 :: 10.26.12.76:/data120... (5 Replies)
Discussion started by: rveri
5 Replies

7. Shell Programming and Scripting

awk :quick question removing empty line.

How to write in awk to remove lines starting with "#" and then process the file: This is not working: cat file|awk '{if ($0 ~ /^#/) $0="";print NF>0}' When I just give cat file|awk '{if ($0 ~ /^#/) $0="";print }' it prints the blank lines . I don't wnat the blank lines along with the... (15 Replies)
Discussion started by: rveri
15 Replies

8. Shell Programming and Scripting

Tip: alternative for NR==FNR in awk

Example: $ cat file1 2 3$ cat file2 1 2 3 4 5 6The following awk script works like a charm, NR==FNR is true for file1, the remainder runs for file2: awk ' NR==FNR {A; next} ($1 in A) ' file1 file2 2 3Now have an empty file1: >file1and run the awk script again. The result is empty... (8 Replies)
Discussion started by: MadeInGermany
8 Replies

9. 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
DBX_COMPARE(3)								 1							    DBX_COMPARE(3)

dbx_compare - Compare two rows for sorting purposes

SYNOPSIS
int dbx_compare (array $row_a, array $row_b, string $column_key, [int $flags = DBX_CMP_ASC | DBX_CMP_NATIVE]) DESCRIPTION
dbx_compare(3) is a helper function for dbx_sort(3) to ease the make and use of the custom sorting function. PARAMETERS
o $row_a - First row o $row_b - Second row o $column_key - The compared column o $flags - The $flags can be set to specify comparison direction: o DBX_CMP_ASC - ascending order o DBX_CMP_DESC - descending order and the preferred comparison type: o DBX_CMP_NATIVE - no type conversion o DBX_CMP_TEXT - compare items as strings o DBX_CMP_NUMBER - compare items numerically One of the direction and one of the type constant can be combined with bitwise OR operator (|). RETURN VALUES
Returns 0 if the row_a[$column_key] is equal to row_b[$column_key], and 1 or -1 if the former is greater or is smaller than the latter one, respectively, or vice versa if the $flag is set to DBX_CMP_DESC. EXAMPLES
Example #1 dbx_compare(3) example <?php function user_re_order($a, $b) { $rv = dbx_compare($a, $b, "parentid", DBX_CMP_DESC); if (!$rv) { $rv = dbx_compare($a, $b, "id", DBX_CMP_NUMBER); } return $rv; } $link = dbx_connect(DBX_ODBC, "", "db", "username", "password") or die("Could not connect"); $result = dbx_query($link, "SELECT id, parentid, description FROM table ORDER BY id"); // data in $result is now ordered by id dbx_sort($result, "user_re_order"); // date in $result is now ordered by parentid (descending), then by id dbx_close($link); ?> SEE ALSO
dbx_sort(3). PHP Documentation Group DBX_COMPARE(3)
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy