Sponsored Content
Top Forums Shell Programming and Scripting Using sed, awk or perl to remove substring of all lines except the first Post 302800049 by Don Cragun on Sunday 28th of April 2013 10:41:54 PM
Old 04-28-2013
Quote:
Originally Posted by jacksolm
Here's a little background information. Due to group member limitations we had to split groups into separate lines by using different group names and identical GIDs. A few help desk admins maintaining the NIS map entered users into all of the groups instead of selecting the latest group to add the user. A single GID could have several group names. I want to loop through the group file and remove the redundant entries.
That was what I understood when I wrote the awk script for you. Did you decide not to try it because it is more than 1 line?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed or Awk to remove specific lines

I have searched the forum for this - forgive me if I missed a previous post. I have the following file: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah alter table "informix".esc_acct add constraint (foreign key (fi_id) references "informix".fi ... (5 Replies)
Discussion started by: Shoeless_Mike
5 Replies

2. Shell Programming and Scripting

How to remove lines before and after with awk / sed ?

Hi guys, I need to remove the pattern (ID=180), one line before and four lines after. Thanks. (5 Replies)
Discussion started by: ashimada
5 Replies

3. Shell Programming and Scripting

perl or awk remove empty lines when condition

Hi Everyone, # cat 1 a b b cc 1 2 3 3 3 4 55 5 a b (2 Replies)
Discussion started by: jimmy_y
2 Replies

4. Shell Programming and Scripting

How to remove spaces using awk,sed,perl?

Input: 3456 565 656 878 235 8 4 8787 3 7 35 878 Expected output: 3456 565 656 878 235 8 4 8787 3 7 35 878 How can i do this with awk,sed and perl? (10 Replies)
Discussion started by: cola
10 Replies

5. Shell Programming and Scripting

Command to remove duplicate lines with perl,sed,awk

Input: hello hello hello hello monkey donkey hello hello drink dance drink Output should be: hello hello monkey donkey drink dance (9 Replies)
Discussion started by: cola
9 Replies

6. Shell Programming and Scripting

Need an awk / sed / or perl one-liner to remove last 4 characters with non-unique pattern.

Hi, I'm writing a ksh script and trying to use an awk / sed / or perl one-liner to remove the last 4 characters of a line in a file if it begins with a period. Here is the contents of the file... the column in which I want to remove the last 4 characters is the last column. ($6 in awk). I've... (10 Replies)
Discussion started by: right_coaster
10 Replies

7. Shell Programming and Scripting

Process alternate lines in awk/sed/perl

hi.. i have a fasta file with the following format >sequence1 CCGGTTTTCGATTTGGTTTGACT >sequence2 AAAGTGCCGCCAGGTTTTGAGTGT >sequence3 AGTGCCGCAGAGTTTGTAGTGT Now, i want to read alternate line and add "GGGGGGGGGGG" to end of every sequence Desired output: >sequence1... (4 Replies)
Discussion started by: empyrean
4 Replies

8. Shell Programming and Scripting

Sed/awk/perl substitution with multiple lines

OSX I have been grinding my teeth on a portion of code. I am building a bash script that edits a html email template. In the template, I have place holders for SED (or whatever program is appropriate) to use as anchors for find and replace, with user defined corresponding html code. The HTML code... (3 Replies)
Discussion started by: sudo
3 Replies

9. Shell Programming and Scripting

Remove lines matching a substring in a specific column

Dear group, I have following input text file: Brit 2016 11 18 12 00 10 1.485,00 EUR Brit 2016 11 18 12 00 10 142,64 EUR Brit 2016 11 18 12 00 10 19,80 EUR Brit 2016 11 18 12 00 10 545,00 EUR Brit 2016 11 18 12 00 10 6.450,00 EUR... (3 Replies)
Discussion started by: gfhsd
3 Replies

10. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies
GROUP(5)						      BSD File Formats Manual							  GROUP(5)

NAME
group -- format of the group permissions file DESCRIPTION
The group file /etc/group is the local source of group information. It can be used in conjunction with the Hesiod domain 'group', and the NIS maps 'group.byname' and 'group.bygid', as controlled by nsswitch.conf(5). The group file consists of newline separated ASCII records, usually one per group, containing four colon ':' separated fields. Each line has the form: group:passwd:gid:[member[,member]...] These fields are as follows: group Name of the group. passwd Group's encrypted password. gid The group's decimal ID. member Group members. The group field is the group name used for granting file access to users who are members of the group. The gid field is the number associated with the group name. They should both be unique across the system (and often across a group of sys- tems) since they control file access. The passwd field is an optional encrypted password. This field is rarely used and an asterisk is normally placed in it rather than leaving it blank. The member field contains the names of users granted the privileges of group. The member names are separated by commas without spaces or newlines. A user is automatically in a group if that group was specified in their /etc/passwd entry and does not need to be added to that group in the /etc/group file. Very large groups can be accommodated over multiple lines by specifying the same group name in all of them; other than this, each line has an identical format to that described above. This can be necessary to avoid the record's length limit, which is currently set to 1024 charac- ters. Note that the limit can be queried through sysconf(3) by using the _SC_GETGR_R_SIZE_MAX parameter. For example: biggrp:*:1000:user001,user002,user003,...,user099,user100 biggrp:*:1000:user101,user102,user103,... The group with the name ``wheel'' has a special meaning to the su(1) command: if it exists and has any members, only users listed in that group are allowed to su to ``root''. HESIOD SUPPORT
If 'dns' is specified for the 'group' database in nsswitch.conf(5), then group lookups occur from the 'group' Hesiod domain. NIS SUPPORT
If 'nis' is specified for the 'group' database in nsswitch.conf(5), then group lookups occur from the 'group.byname' and 'group.bygid' NIS map. COMPAT SUPPORT
If 'compat' is specified for the 'group' database, and either 'dns' or 'nis' is specified for the 'group_compat' database in nsswitch.conf(5), then the group file may also contain lines of the format +name:*:: which causes the specified group to be included from the 'group' Hesiod domain or the 'group.byname' NIS map (respectively). If no group name is specified, or the plus sign (``+'') appears alone on line, all groups are included from the Hesiod domain or the NIS map. Hesiod or NIS compat references may appear anywhere in the file, but the single plus sign (``+'') form should be on the last line, for his- torical reasons. Only the first group with a specific name encountered, whether in the group file itself, or included via Hesiod or NIS, will be used. FILES
/etc/group SEE ALSO
newgrp(1), passwd(1), su(1), setgroups(2), crypt(3), initgroups(3), nsswitch.conf(5), passwd(5), yp(8) HISTORY
A group file format appeared in Version 6 AT&T UNIX. The NIS file format first appeared in SunOS. The Hesiod support first appeared in NetBSD 1.4. BUGS
The passwd(1) command does not change the group passwords. BSD
June 21, 2007 BSD
All times are GMT -4. The time now is 05:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy