Sponsored Content
Top Forums Shell Programming and Scripting To find the line no, where the particular pattern is not found Post 302333447 by rakeshawasthi on Monday 13th of July 2009 05:57:34 AM
Old 07-13-2009
Your requirement is incomplete.
Code:
2012156|sb3|nwknjps|BAYONNE|NJ|tcg
201221|094|mtnnjprc:HACKENSACK|NJ|tcg
201222|wn3|mtnnjtc|HACKENSACK|NJ|tcg
2018164|ik4|mtnntc|JERSEY CITY|NJ|tcg
20123482|ik4|mtnnjpritc,JERSEY CITY|NJ|tcg
2012444016|sb2|mvlnjpritc|DUMONT|NJ|tcg

Why not the last field incorrect?

At what position do you expect pipe ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

change line found by pattern using sed

I want to change a line like CPM_THRESHOLD 0.8 // to a new value using sed I am trying sed -i "s/CPM_THRESHOLD/CPM_THRESHOLD\t$COH\t\t\/\//" $INPUT_4 but how can i substitute the whole line begining with CPM_THRESHOLD and substitute it? (2 Replies)
Discussion started by: larne
2 Replies

2. Shell Programming and Scripting

How to replace a line below where the pattern found

Hi All, I have a file say abc.xml. In this file, I need to search for a pattern “SAP_GATEWAY_HOST”; if this pattern found and the next line also contain the pattern “nwprc03.cos” then I need to replace this pattern “nwprc03.cos” with some other pattern “nwdrc03.apjp”. $ cat abc.xml... (3 Replies)
Discussion started by: Ritesh.patni84
3 Replies

3. Shell Programming and Scripting

Delete line if pattern not found

I thought that this was going to be quit simple using sed but i wasn't able to find a way to delete the second line of a text file if my pattern was not found in the line With awk i am completly useless :rolleyes: Any ideas? (2 Replies)
Discussion started by: jepeto
2 Replies

4. Shell Programming and Scripting

extract specific line if the search pattern is found

Hi, I need to extract <APPNUMBER> tag alone, if the <college> haas IIT Chennai value. college tag value will have spaces embedded. Those spaces should not be suppresses. My Source file <Record><sno>1</sno><empid>E0001</empid><name>Rejsh suderam</name><college>IIT ... (3 Replies)
Discussion started by: Sekar1
3 Replies

5. UNIX for Dummies Questions & Answers

Replace line with found unknown pattern

Hi, I have a file with the following content: --------- a 3242 tc_5 gdfg4 random text a 3242 tc_6 gdfg4 random text a 3242 tc_7 gdfg4 random text a 3242 tc_4 gdfg4 --------- I want to replace the lines containing tc_? (tc_5, tc_6 etc. even with unknown numbers) with the found... (5 Replies)
Discussion started by: joas
5 Replies

6. Shell Programming and Scripting

Append next line to previous line when one pattern not found

Hi, I need help for below scenario.I have a flat file which is having records seperated by delimiters which will represent each record for oracle table.My Control file will consider each line as one record for that table. Some of the lines are aligned in two/three lines so that records are... (4 Replies)
Discussion started by: kannansr621
4 Replies

7. Shell Programming and Scripting

Displaying text till pattern match found in a line

Hi All, From the below line if we want to display all the text till found pattern dot/. I was trying with the below code but couldn't able to print text before the pattern. it display texts which is found after pattern. awk '/assed/{print;getline;print}' file_name | sed 's/^*. *//' input... (4 Replies)
Discussion started by: Optimus81
4 Replies

8. Shell Programming and Scripting

If first pattern is found, look for second pattern. If second pattern not found, delete line

I had a spot of trouble coming up with a title, hopefully you'll understand once you read my problem... :) I have the output of an ldapsearch that looks like this: dn: cn=sam,ou=company,o=com uidNumber: 7174 gidNumber: 49563 homeDirectory: /home/sam loginshell: /bin/bash uid: sam... (2 Replies)
Discussion started by: samgoober
2 Replies

9. Shell Programming and Scripting

Append text on particular line after pattern found

hi, i have /etc/inittab, I want to add another line after that when i find a pattern "l6:6:wait:/etc/rc.d/rc 6". original l6:6:wait:/etc/rc.d/rc 6 after-change l6:6:wait:/etc/rc.d/rc 6 /sbin/if-pp-to-cng (3 Replies)
Discussion started by: learnbash
3 Replies

10. UNIX for Dummies Questions & Answers

How to find a file based on pattern & return the filename if found?

Hi all, I am a newbie here. I have this requirement to find a file based on a pattern then return the filename if found. I created a script based on online tutorials. Though, I am stuck & really appreciate if anyone can have a quick look & point me to the right direction? #Script starts... (10 Replies)
Discussion started by: buster_t
10 Replies
getprdfent(3)						     Library Functions Manual						     getprdfent(3)

NAME
getprdfent(), getprdfnam(), setprdfent(), endprdfent(), putprdfnam() - manipulate system default database entry for a trusted system SYNOPSIS
DESCRIPTION
and each returns a pointer to an object with the following structure containing the broken-out fields of a line in the system default data- base. Each line in the database contains a pr_default structure, declared in the header file: struct system_default_fields { time_t fd_inactivity_timeout ; char fd_boot_authenticate ; } ; struct system_default_flags { unsigned short fg_inactivity_timeout:1, fg_boot_authenticate:1, } ; struct pr_default { char dd_name[20] ; char dg_name ; struct pr_field prd ; struct pr_flag prg ; struct t_field tcd ; struct t_flag tcg ; struct dev_field devd ; struct dev_flag devg ; struct system_default_fields sfld ; struct system_default_flags sflg ; } ; Currently there is only one entry in the system default database referenced by name The System Default database contains default values for all parameters in the Protected Password, Terminal Control, and Device Assignment databases, as well as configurable system-wide parameters. The fields from the other databases are described in the corresponding manual entries. fd_inactivity_timeout is the number of seconds until a session is terminated on trusted systems. fd_boot_authenticate is a Boolean flag that indicates whether an authorized user must authenticate before the system begins operation. returns a pointer to the first pr_default structure in the database when first called. Thereafter, it returns a pointer to the next pr_default structure in the database so that successive calls can be used to search the database (only one entry is supported). searches from the beginning of the file until a default entry matching name is found, and returns a pointer to the particular structure in which it was found. If an end-of-file or an error is encountered on reading, these functions return a NULL pointer. Currently, all pro- grams access the default database by calling (the entry name is A call to has the effect of rewinding the default control file to allow repeated searches. can be called to close the database when pro- cessing is complete. puts a new or replaced default control entry pr with key name into the database. If the prg.fd_name field is 0, the requested entry is deleted from the system default database. locks the database for all update operations and performs an after the update or failed attempt. Notes The value returned by and refers to a structure that is overwritten by calls to these routines. To retrieve an entry, modify it, and replace it in the database, copy the entry using structure assignment and supply the modified buffer to Programs using these routines must be compiled with APPLICATION USAGE
In a multithreaded application, these routines are safe to be called only from one dedicated thread. These routines are not POSIX.1c async-cancel safe nor async-signal safe. RETURN VALUE
and return NULL pointers on or error. returns 0 if it cannot add or update the entry. WARNINGS
Do not delete the system default entry. HP-UX 11i Version 3 is the last release to support trusted systems functionality. FILES
System Defaults database SEE ALSO
authcap(4), default(4), getprpwent(3), getprtcent(3), getdvagent(3). TO BE OBSOLETED getprdfent(3)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy