Sponsored Content
Top Forums Shell Programming and Scripting Shell Script to ignore # and take corresponding user and group Post 302580339 by methyl on Thursday 8th of December 2011 07:41:55 AM
Old 12-08-2011
This is the same format file as before but with an awkward header section.
We can jump the header section with "sed" and start from the first line starting with "role".
Code:
Minor change to original code:
sed -n '/^role/,$ p' filename.txt | grep -v \^\#"role" |  .... etc

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to rename a group of files

Hello, I am having 1800 files in a directory with a specified format, like amms_850o_prod.000003uNy amms_850o_prod.000003u8x amms_850o_prod.000003taP amms_850o_prod.000003tKy amms_850o_prod.000003si4 amms_850o_prod.000003sTP amms_850o_prod.000003sBg amms_850o_prod.000003rvx... (12 Replies)
Discussion started by: atlantis
12 Replies

2. Shell Programming and Scripting

script to ignore the user from list of users

Hi, I have a situation where I want to ignore few users from list of users and print rest of user in log file. say, I want to ignore aaa, bbb, ccc, ddd .. ppp from list of 20 user (do not want to include) What is the good command or any script? Thanks in advance. (1 Reply)
Discussion started by: sumit30
1 Replies

3. Shell Programming and Scripting

Ignore lines in Shell Script

Hi, I have a shell script, which reads a *.txt file - line by line. In this text file, I have some lines beginning with "#" that I want to ignore : MY_FILE #blah blah blah 1 blah blah blah 2 blah blah blah 3 #blah blah blah 4 I want my script to read only the following lines... (3 Replies)
Discussion started by: ad23
3 Replies

4. Shell Programming and Scripting

New To UNIX - Need Script to create report of user & group accounts

Hi, I'm new to the world of UNIX and have been asked to create a complex script (at least complex to me:confused:) for AIX UNIX to create a report of all the users on the server including server, user, UID, groups, GID, etc. Found a script using lsuser, but the output is still lacking. 2 things I... (2 Replies)
Discussion started by: panthur
2 Replies

5. Shell Programming and Scripting

Ignore Folder in Shell Script ?

Hi, I currently use a script to extract *.deb files located in a Directory called "/var/mobile/Media/Downloads" The Problem is howver I want the script to ignore the folder: "/var/mobile/Media/Downloads/New Debs and Files" (it shall NOT decompile any of the files in that folder. Here is... (2 Replies)
Discussion started by: pasc
2 Replies

6. Red Hat

User is a Part of a Group But Group Details Do Not Show the User

Hi, In the following output you can see the the user "richard" is a member on the team/group "developers": # id richard uid=10247(richard) gid=100361(developers) groups=100361(developers),10053(testers) but in the following details of the said group (developers), the said user... (3 Replies)
Discussion started by: indiansoil
3 Replies

7. Shell Programming and Scripting

Shell script - group by

Hi, I have text file as shown below. root 25 oracle 25 batch 30 griduser 32 admin 35 root 25 oracle 25 batch 30 griduser 32 oracle 25 batch 30 griduser 32 xuser 45 admin 35 I want to group by based on user name, and the output need to be as below. Not necessary the username to be... (10 Replies)
Discussion started by: baladelaware73
10 Replies

8. Shell Programming and Scripting

Emulate group-by in shell script

Hello All, I saw this problem on one of the forum and solved it using group-by in oracle sql, though I am a bit curious to implement it using shell script : There is a file having number of operations : Opeation,Time-Taken operation1,83621 operation2,72321 operation3,13288... (11 Replies)
Discussion started by: mukulverma2408
11 Replies

9. UNIX for Beginners Questions & Answers

How to ignore mutiple strings when using shell script?

Hi All, I am trying to use below syntax to find ignore multiple locations while searching for a file. find / -name "$serviceitem" ! -size 0 2>&1 |egrep -v "tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest" I tried to assign all the ignore strings to one variable... (2 Replies)
Discussion started by: sravani25
2 Replies
KNIFE-ROLE(1)							    Chef Manual 						     KNIFE-ROLE(1)

NAME
knife-role - Group common configuration settings SYNOPSIS
knife role sub-command (options) ROLE SUB-COMMANDS The following role subcommands are available: LIST
knife role list (options) -w, --with-uri Show corresponding URIs List roles. SHOW
knife role show ROLE (options) -a, --attribute ATTR Show only one attribute Show a specific role. CREATE
knife role create ROLE (options) -d, --description The role description Create a new role. EDIT
knife role edit ROLE (options) Edit a role. FROM FILE
knife role from file FILE (options) Create or update a role from a role Ruby DSL (.rb) or JSON file. DELETE
knife role delete ROLE (options) Delete a role. BULK DELETE
knife role bulk delete REGEX (options) Delete roles on the Chef Server based on a regular expression. The regular expression (REGEX) should be in quotes, not in //'s. DESCRIPTION
Roles provide a mechanism to group repeated configuration settings. Roles are data structures that contain default_attributes, and over- ride_attributes, which are nested hashes of configuration settings, and a run_list, which is an ordered list of recipes and roles that should be applied to a host by chef-client. default_attributes will be overridden if they conflict with a value on a node that includes the role. Conversely, override_attributes will override any values set on nodes that apply them. When chef-client(8) configures a host, it will "expand" the run_list included in that host's node data. The expansion process will recur- sively replace any roles in the run_list with that role's run_list. SEE ALSO
knife-node(1) knife-environment(1) http://wiki.opscode.com/display/chef/Roles http://wiki.opscode.com/display/chef/Attributes AUTHOR
Chef was written by Adam Jacob adam@opscode.com with many contributions from the community. DOCUMENTATION
This manual page was written by Joshua Timberman joshua@opscode.com. Permission is granted to copy, distribute and / or modify this docu- ment under the terms of the Apache 2.0 License. CHEF
Knife is distributed with Chef. http://wiki.opscode.com/display/chef/Home Chef 10.12.0 June 2012 KNIFE-ROLE(1)
All times are GMT -4. The time now is 05:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy