$list_A contains a list of user ID's.
$pwdfile_new is the unix password file.
$useralias is a report file
I'm trying to search through the password file with the list in list_A and dumping what ever name it matches into the useralias file. But I want to the code to put "Unable to resolve user" into the report if it cannot find the ID in the password file.. I was trying the below but its not working..
I'll admit it aint the prettiest piece of code ever but it half works and I'm under pressure to get this script finished for the business..
I've 4 files I'm working with here..
${grouplist}_temp2 Contains a list of the groups in the report. E.g.
OCC
root
admin
printgroup
$list_C contains a list of all the secondary user ID's belonging to the Groups in the ${grouplist}_temp2 E.g.
x111222333
x111333444
x224422333
$pwdfile_new contains user ID's and the names associated with them
${grouplist}_2 is a file which contains the group names and all the xid's asociated with them. E.g.
OCC=x1332223, x4324523, w2324233, x12451213
admin=x2136423, x1332223, w2324233, x4444444, x1212323
printgroup=x12451213
I need to replace the group ID's in the ${grouplist}_2 file with their matched username E.g. x111222333=Joe Bloggs
But I also need it to return Name_Not_Found if the xid is not contained in that $pwdfile_new file..
E.g. x224422333=Name_Not_Found
If someone can suggest a better way that would be much appreciated...
EDIT****
Ok I've changed it around a bit but when it finds a match it should be echoing out $useridvar $to_replace9 but it seems to be echoing out echo $useridvar $matchgrpusr instead... Been looking at this so long now nothings making sense
Hi I have script
if ; then
echo "Found Node"
else
echo "Sorry this is not a node"
I need to add conditions "nn" ,"rm", and "hh" in the same line along with "hd" .Can this be done or do I need to use elif (1 Reply)
Hi,
I have a requirement where I have to check for 10 files in Unix location. If all of the files present in that directory then i have execute another process.
can you help me resolving this issue.
sample
location
/home/usr
abc.txt
cde.txt
aaaa.txt
lll.txt
ooo.txt
if all the... (3 Replies)
Hi,
I'm trying to put together a small script that will read a txt file that contains a list of two columns. Each column is the name of a folder..
e.g.
AIX Server1
AIX Server2
AIX Server3
$ for i in `cat /opt/apacheprod/scripts/input/copy_list.txt`
do
PLATFORMVAR=`awk ' { print $1 } '... (7 Replies)
hey guys what im trying to do is do a simple script that will ask for a password and on the 5th time it says access denied if the right password is still not entered this is what i have so far can anyone help me im not good with scripting
thanks in advance
#!/bin/bash
secretname=secret... (2 Replies)
I'm improving the way an existing script handles arrays, but the results aren't what I had in mind:
e="Too many consecutive errors... System is probably unstable!"
e="Cancelable Timer Wait Failed!"
for errcd in ${e}
do
echo ${errcd}
done
The for loop interprets the spaces... (2 Replies)
Hi all
Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Hi
I want to take an input untill the user presses 'n' or 'N' and run a command based on the input I want to store the output of the command in a file called output.txt ( append mode ).
Please tell the script for the same. Here is the psuedocode
while ( n or N pressed )
do
read var
run... (2 Replies)
Hi, I am writing a bash shell script. I will have a section of code devoted to a for loop:
for FILE in *.hdf *.L2; do
echo hello world
done
The complication is that sometimes there will not be any files with a ".hdf" extension, or sometimes there won't be any with a ".L2" extension. Since... (4 Replies)
while
do
print What is the next device number to be added to $dgroup?
print Press \<Enter\> if there are no more devices to be added.
read dev_num
export dev_num
symld -g $dgroup -sid $sname add dev $dev_num
done
In this while... (2 Replies)
hi,
how would i go about making a loop which gets each line from a single text file, set it to a variable and then print it to screen?
thanks
eg:
#!/bin/sh
FILE="somefile.txt"
text_line=""
what kind of loop would use here? (18 Replies)