Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to delete everything present on left (or right) of a substring? Post 303041022 by RudiC on Tuesday 12th of November 2019 10:21:39 AM
Old 11-12-2019
man awk:
Quote:
match(s,r)
Returns the index of the first longest match of regular expression r in string s. Returns 0 if no match. As a side effect, RSTART is set to the return value. RLENGTH is set to the length of the match or -1 if no match. If the empty string is matched, RLENGTH is set to 0, and 1 is returned if the match is at the front, and length(s)+1 is returned if the match is at the back.
The match searches $0 for your target string PCX..._1 (the ellipsis replaced by [^_]*, i.e. non-"_" characters), and, if found, sets RSTART and RLENGTH accordingly for immediate use by the substr function.


BTW, that awk scriptlet doesn't need the upfront grep (as it checks lines for PROTOBUF_DIRS already and on its own), and it can be adapted to also make the uniq redundant.

Last edited by RudiC; 11-13-2019 at 01:51 PM..
These 2 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what left of the pattern

I have a script which loop through a directory then report any file matches the given pattern, say, the pattern is "a2006", this file would be returned a20061101.txt I would like to know how can I get the remaining of the filename, so a20061101txt - a2006 = 1101.txt Can anybody help? Thank... (2 Replies)
Discussion started by: mpang_
2 Replies

2. UNIX for Dummies Questions & Answers

indenting lines to the left

hi i have a file which is like this : aab ghj ghj lsklk lklkl; ashjd kjs alskj How do i remove the spaces from the beginning of a line so that all lines are indented to the left? (1 Reply)
Discussion started by: napolayan
1 Replies

3. Solaris

No space left on device

Hi all, A very strange problem I have this morning with my Solaris 8. I have a FS full, I deleted some files but the system doesn't seems to reallocate the free space (I'm using Veritas): df -k : /dev/vx/dsk/dlds02vg/dlds02oralv 4194304 4194304 0 100% /dlds02/lds/oracle ... (4 Replies)
Discussion started by: unclefab
4 Replies

4. Shell Programming and Scripting

Delete Strings that are present in another file

HI, if a String is present in file1.txt, i want to delete that String from file2.txt. How can i do this?? I am sure that the file1.txt is a subset of file2.txt. (2 Replies)
Discussion started by: jathin12
2 Replies

5. Shell Programming and Scripting

Left padding in Unix

I am passing input string,length, and the pad character. input string=123 Pad char=# Length=6 then the output should be: ###123 How we can do this? Thanks (5 Replies)
Discussion started by: pandeesh
5 Replies

6. Shell Programming and Scripting

Delete a pattern present in file 2 from file 1 if found in file 1.

I have two files File1 ==== 1|2000-00-00|2010-02-02|| 2| 00:00:00|2012-02-24|| 3|2000-00-00|2011-02-02|| File2 ==== 2000-00-00 00:00:00 I want the delete the patterns which are found in file 2 from file 1, Expected output: File1 ==== (5 Replies)
Discussion started by: machomaddy
5 Replies

7. Shell Programming and Scripting

Need unix commands to delete records from one file if the same record present in another file...

Need unix commands to delete records from one file if the same record present in another file... just like join ... if the record present in both files.. delete from first file or delete the particular record and write the unmatched records to new file.. tried with grep and while... (6 Replies)
Discussion started by: msathees
6 Replies

8. Shell Programming and Scripting

left join using awk

Hi guys, I need to use awk to join 2 files file_1 A 001 B 002 C 003 file_2 A XX1 B XX2 output desired A 001 XX1 B 002 missing C 003 XX2 thank you! (2 Replies)
Discussion started by: g1org1o
2 Replies

9. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

10. AIX

How much resources is left on the P7?

I know that it is possible to login into the HMC console and view all the specs like, how much CPU/RAM every LPAR has. But how can I check how much the whole P7 has in total and how much is left to creat a new LPAR:wall: (5 Replies)
Discussion started by: DiViN3
5 Replies
fprintd(1)																fprintd(1)

NAME
fprintd - Fingerprint management daemon, and test applications SYNOPSYS
fprintd-enroll [username] fprintd-list username [usernames...] fprintd-verify [-f finger] [usename] fprintd-delete username [usernames...] DESCRIPTION
This manual page documents briefly the fprintd command-line utilities. The fprintd daemon is accessed through D-Bus by those command-line utilities. ARGUMENTS
username The username for the user for which you want to query or modify the fingerprint database. Not that fprintd-list and fprintd-delete require at least one username to be passed, and support multiple usernames. fprintd-enroll and fprintd-verify will use the current username if none are passed on the command-line. -f finger For fprintd-enroll, the finger to enroll. Possible values are: left-thumb, left-index-finger, left-middle-finger, left-ring-finger, left-little-finger, right-thumb, right-index-finger, right- middle-finger, right-ring-finger, right-little-finger. The default is automatic, selecting the first available finger for swipe devices, or all the enrolled fingers, for press devices. TEST APPLICATIONS
fprintd-enroll Will enroll the user's right index finger into the database. fprintd-list Will list the user's enrolled fingerprints. fprintd-verify Will enroll the user's right index finger into the database. fprintd-enroll Will enroll the user's right index finger into the database. AUTHOR
fprintd was written by Bastien Nocera and Daniel Drake. DIRECTORIES
By default, fprintd stores the fingerprints in /var/lib/fprint/ SEE ALSO
dbus-daemon, gnome-about-me freedesktop 2014-06-10 fprintd(1)
All times are GMT -4. The time now is 08:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy