Sponsored Content
Top Forums Shell Programming and Scripting Egrep how to make sure string is after 5 comma Post 302861981 by Subbeh on Thursday 10th of October 2013 03:15:51 AM
Old 10-10-2013
This will print the line if the letter "f" is in field 6 or more:
Code:
echo a,b,c,d,e,f,g,h,i | awk -F, '{ p=0; for (i=6; i<=NF; i++) { if ($i ~ /f/) p=1 } } p'


Last edited by Subbeh; 10-10-2013 at 04:21 AM..
This User Gave Thanks to Subbeh For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comma Delimited Output w/ egrep

Hi all, I have an input file that I am pulling out certain phases using the following commands: cat /nodes.txt | egrep -e 'OSVersion|PrimaryNodeName' Currently the output looks like this: OSVersion - 5.0 PrimaryNodeName - serverA OSVersion - 5.0 PrimaryNodeName - serverB OSVersion... (2 Replies)
Discussion started by: indianadoug
2 Replies

2. Shell Programming and Scripting

how to make menu of result from egrep

hi, im just starting with scripting , i have de following situation im doing a search in a data folder with egrep egrep -i "title.regu." `find . -name "*.dat"` the result is : ./20080816212245/index.dat:title Regular Expressions ./20080811212216/index.dat:title ... (5 Replies)
Discussion started by: tvrman
5 Replies

3. Shell Programming and Scripting

comma separated string manipulation

hi, i have a script where i am accepting a comma separated string from the user, i have to separated those strings on the basis of comma and store it in variables.. below is the script #!/bin/ksh clear echo "Enter the strings seperated by commas :- \c " read strn echo $strn... (2 Replies)
Discussion started by: saharookiedba
2 Replies

4. Shell Programming and Scripting

Delete a comma from string

Hey guys, Its a simple question though, but since I'm new to this shell scripting world ... it's kind of difficult. Say I have some string as : ListenAddress=ABCServer1,ABCServer2 I want to output the value of ListenAddress as ... ABCServer1 ABCServer2 so, basically, I want to... (6 Replies)
Discussion started by: MisterKhan
6 Replies

5. Shell Programming and Scripting

egrep string except when preceded by underscore

having trouble with this seemingly simple taks.. :mad: Test data: we want to keep lines 2,3 & 4 -- want to exclude when ${.*schema} is preceded with an underscore; Valid {.*schema} should always be preceded spaces or be found at the beginning of a line. egrep... (5 Replies)
Discussion started by: danmauer
5 Replies

6. Shell Programming and Scripting

Awk: Remove comma at the end of the string

Hi i had String like UID: ABC345QWE678GFK345SA90, LENGTH 32 when I used awk ' FS, {print $1}' prints ABC345QWE678GFK345SA90, how can i getrid of that coma at the end of the string. Thanks in advance.. (14 Replies)
Discussion started by: Reddy482
14 Replies

7. Shell Programming and Scripting

Replace a value after 13th comma in a string

Suppose b=50,0,0,40,1,0,5000,gold,0,0,0,0,32,9,2,0,10000,0,0,0,0,0,0,0,0,0,BSNL_SMS_Bundle ,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,0,null,null,0,0,405564245,0 c=11 After 13th comma, the value of 9 needs to be changed and to be filled by another... (4 Replies)
Discussion started by: karan23kohli
4 Replies

8. Shell Programming and Scripting

bash: need to have egrep to return a text string if the search pattern has NOT been found

Hello all, after spending hours of searching the web I decided to create an account here. This is my first post and I hope one of the experts can help. I need to resolve a grep / sed / xargs / awk problem. My input file is just like this: ----------------------------------... (6 Replies)
Discussion started by: bash4ever
6 Replies

9. Shell Programming and Scripting

Make multiple lines into single quoted comma separated Linux

Hi, I want to change a file file1.txt: 1234 3456 2345 6789 3456 2333 4444 As, file2.txt in Linux: '1234','3456','2345','6789','3456','2333','4444' Could someone please help me. (Single liner sed, awk will be welcome!) (7 Replies)
Discussion started by: wiweq05
7 Replies

10. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
GEOIP_REGION_NAME_BY_CODE(3)						 1					      GEOIP_REGION_NAME_BY_CODE(3)

geoip_region_name_by_code - Returns the region name for some country and region code combo

SYNOPSIS
string geoip_region_name_by_code (string $country_code, string $region_code) DESCRIPTION
The geoip_region_name_by_code(3) function will return the region name corresponding to a country and region code combo. In the United States, the region code corresponds to the two-letter abbreviation of each state. In Canada, the region code corresponds to the two-letter province or territory code as attributed by Canada Post. For the rest of the world, GeoIP uses FIPS 10-4 codes to represent regions. You can check http://www.maxmind.com/app/fips10_4 for a detailed list of FIPS 10-4 codes. This function is always available if using GeoIP Library version 1.4.1 or newer. The data is taken directly from the GeoIP Library and not from any database. PARAMETERS
o $country_code - The two-letter country code (see geoip_country_code_by_name(3)) o $region_code - The two-letter (or digit) region code (see geoip_region_by_name(3)) RETURN VALUES
Returns the region name on success, or FALSE if the country and region code combo cannot be found. EXAMPLES
Example #1 A geoip_region_name_by_code(3) example using region code for US/Canada This will print the region name for country CA (Canada), region QC (Quebec). <?php $region = geoip_region_name_by_code('CA', 'QC'); if ($region) { echo 'Region name for CA/QC is: ' . $region; } ?> The above example will output: Region name for CA/QC is: Quebec Example #2 A geoip_region_name_by_code(3) example using FIPS codes This will print the region name for country JP (Japan), region 01. <?php $region = geoip_region_name_by_code('JP', '01'); if ($region) { echo 'Region name for JP/01 is: ' . $region; } ?> The above example will output: Region name for JP/01 is: Aichi PHP Documentation Group GEOIP_REGION_NAME_BY_CODE(3)
All times are GMT -4. The time now is 07:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy