Sponsored Content
Top Forums Shell Programming and Scripting encrytion/substitution issue in a file Post 302362397 by danmero on Friday 16th of October 2009 12:25:58 AM
Old 10-16-2009
Let's try this one Smilie
Code:
awk -F: '/\+DEF/{for(i=0;++i<NF;){if($i~/\+DEF/&&length($(i+12))>=15){sub(substr($(12+i),5,6),"******",$(12+i))}}}1' OFS=":" file

 

10 More Discussions You Might Find Interesting

1. Solaris

Variable Substitution Issue

#!/bin/ksh VAR_ONE=HELLO TEMP=ONE echo $VAR_${TEMP} ## Output is: ONE Hi, I want the output to echo HELLO and not ONE as the above script does. I know I am missing something with dollar substitution. Can anyone help me out ? Thanks. Cal (4 Replies)
Discussion started by: calredd
4 Replies

2. Shell Programming and Scripting

Need help with file substitution

hello all just trying to write a script that will read a file (line by line) and substitute (tht line) in a different file if (tht line) is present in second file Ex: script has to read file A (line by line) and if file B has tht line it should get substituted with the line in file A ... (3 Replies)
Discussion started by: coolkid
3 Replies

3. Shell Programming and Scripting

Issue in substitution

Hi , I have have file which has following structure 01aaaa88888000-9999 01ssss77777000-0991 01ssss7777700000991 02ssss7777700000991 The record 01 is corrupt as value from 12th field to 19th should be positive or start with - however it is 000-9999 it should be -0009999 i need to... (4 Replies)
Discussion started by: test_user
4 Replies

4. Shell Programming and Scripting

How to change a substitution value in a file?

Hi, i want to change a subs. value in a file, with using a script.. this is my script... (example) #!/bin/bash NDIR=`zenity --file-selection --directory` mv $HOME/Desktop/myfile /tmp/myfile.temp XT='"' perl -pe "s/.*/DIR=$XT`echo -e "$NDIR"`$XT/ if $. == 40" <... (2 Replies)
Discussion started by: excsra
2 Replies

5. Shell Programming and Scripting

sed pattern substitution issue?

Hello everyone ... I'm going crazy, I hope some of you can help me ... I have to replace a line in a crontab like this: 5 2 * * 2 root backupdat with this: 5 5 * * 3 root backupdat the command I use is the following: sed -i.bak -e 's/5 2 * * 2 root backupdat/5 5 * * 3 root... (4 Replies)
Discussion started by: ionral
4 Replies

6. Shell Programming and Scripting

Issue with substitution using sed

Hi all Having issue with substitution using sed Trying to assign the absolute path of the file to the variable 'floc' returned by the find command floc=`find / -name $fname` eg cat $floc '/root/samplecheck/myfile' I want to replace '/' with '->' in the 'floc' i am using the below sed... (2 Replies)
Discussion started by: amithsebkanattt
2 Replies

7. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

8. Shell Programming and Scripting

Substitution Issue with nawk

Hi, I'm trying to reformat some badly formatted XML that I've extracted from Oracle clob columns using the following nawk command: nawk '{gsub(/&lt;/,/>\n/); print}' test.raw > test.xml the substitution executes fine, but instead of subbing &lt; with > followed by newline, it subs the &lt; with a... (3 Replies)
Discussion started by: sffuji
3 Replies

9. Shell Programming and Scripting

Multiple variable substitution in a file in one go

I have a huge script which is defining variables with full path of commands in the beginning of code and using those variables in the script. For Example: ECHO=/bin/echo LS=/bin/ls SED=/bin/sed AWK=/bin/awk UNAME=/bin/uname PS=/bin/ps DATE=/bin/date GREP=/bin/grep $ECHO "hello... (1 Reply)
Discussion started by: veeresh_15
1 Replies

10. Shell Programming and Scripting

File Extension Substitution

Hi, I have a script in which the file name is always known, but the extension could vary. I want to be able to use a single variable; no if-else statements. For example, if I have config.txt in the directory then that's what I want to use, but if config.xml is in the directory then use that. The... (9 Replies)
Discussion started by: ocbit
9 Replies
chfn(1) 						      General Commands Manual							   chfn(1)

Name
       chfn - change system finger entry

Syntax
       chfn [ loginname ]

Description
       The  command  is used to change information about users.  This information is used by the program, among others.  It consists of the user's
       real name, office room number, office phone number, and home phone number. The command prompts the user for each field.	 Included  in  the
       prompt  is  a  default  value,  which is enclosed between brackets.  The default value is accepted simply by typing <CR>.  To enter a blank
       field, type the word `none'.  This is an example:
       % chfn
       Changing finger information for doe
       Name [John Doe]:
       Office number [ABC-1/K0]: DEF-2/K1
       Office Phone []: 1863
       Home Phone [5771546]: none

       The command allows phone numbers to be entered with or without hyphens.	No entries may contain colons, commas, or control characters.

       It is a good idea to run after running to make sure everything is the way you want it.

       The optional argument loginname is used to change another person's finger information.  This can only be done by the superuser.

Restrictions
       The encoding of the office and extension information is installation dependent.

       Because two users may try to write the file at once, a synchronization method was developed.  On rare occasions, a message that	the  pass-
       word file is "busy" will be printed.  In this case, sleeps for a while and then tries to write to the file again.

       If the passwd entry is distributed from another host will not modify it.

       See Also
	      chsh(1), finger(1), passwd(1), passwd(5yp)

																	   chfn(1)
All times are GMT -4. The time now is 02:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy