Converting HP-UX awk to Solaris

Trivia Category: Science: Computers
Difficulty: Easy
Ada Lovelace is often considered the first computer programmer.
True or False?

Thread Tools Search this Thread
# 1  
Converting HP-UX awk to Solaris


I am using awk in HP-UX to enter an encrypted entry of the password into /etc/passwd with success, this is the command I am using and it is working great.

cat /tmp/|awk -F: -v gal_passwd="encrypted_password" '{OFS=":" ; print $1,gal_passwd,$3,$4,$5,$6,$7}' > /tmp/

entry before awk:

entry after awk:

However, For solaris I am not able to use the same command, i've seen that in Solaris the awk command is diffrent (alot of complaints about it)

Can someone please explain how to modify it for Solaris?
the password is stored on /etc/shadow but that doesnt matter for now

Regards, Gal
# 2  
Try using "nawk" on Solaris:
cat /tmp/|nawk -F: -v gal_passwd="encrypted_password" '{OFS=":" ; print $1,gal_passwd,$3,$4,$5,$6,$7}' > /tmp/

# 3  
There should be a posix compliant version in /usr/xpg4/bin/awk or check for gawk on the system.


# 4  
/usr/xph4/bin/awk is working fine!! thanks!

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using awk for converting xml to txt

Hi, I have a xml script, I converted it to .txt with values comma seperated using awk function. But I want the output values should be inside double quotes My xml script (Workorders.xml) is shown like below: <?xml version="1.0" encoding="utf-8" ?> <scbm-extract version="3.3">... (8 Replies)
Discussion started by: Viswanatheee55
8 Replies

2. Shell Programming and Scripting

Converting shell/awk to ruby

any idea on how to get started with this: shell script: awk '/{/,/}/' ~/newservices.txt | while read line do BEGIN=$(echo "${line}" | egrep ":" | egrep "{") if ; then checkname=$(echo $line | awk -F":" '{print $1}' | sed 's_"__g') echo "{"... (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Shell Programming and Scripting

Converting awk script from bash to csh

I have the following script set up and working properly in bash. It basically copies a set of lines which match "AS1100002" from one file and replaces the same lines in another file. awk -vN=AS1100002* 'NR==FNR { if($1 ~ N)K=$0; next } { if($1 in K) $0=K; print }' $datadir/file1... (7 Replies)
Discussion started by: ncwxpanther
7 Replies

4. Shell Programming and Scripting

awk - problems by converting date-format

Hi i try to change the date-format from DD/MM/YYYY into MM/DD/YY. Input-Data: ... 31/12/2013,23:40,198.00,6.20,2,2,2,1,11580.0,222 31/12/2013,23:50,209.00,7.30,2,2,3,0,4380.0 01/01/2014,00:00,205.90,8.30,2,2,3,1,9360.0,223 ... Output-Data should be: ...... (7 Replies)
Discussion started by: IMPe
7 Replies

5. Shell Programming and Scripting

Converting from Linux bash (GNU) to Solaris script syntax errors

Original script written on CentOS 6.3 with GNU bash 4.1.2 Destination system is Solaris 9 with GNU bash 2.05 (not changeable by me) I have a script written on the linux side but now we need to provide a version to another site that "doesn't like linux". I've been going through changing the ] or... (13 Replies)
Discussion started by: oly_r
13 Replies

6. Shell Programming and Scripting

Converting to matrix-like file using AWK

Hi, Needs for statistics, doing converting Here is a sample file Input : 1|A|17,94 1|B|22,59 1|C|56,93 2|A|63,71 2|C|23,92 5|B|19,49 5|C|67,58 expecting something like that Output : 1|A|17,94|B|22,59|C|56,93 2|A|63,71|B|0|C|23,92 5|A|0|B|19,49|C|67,58 (11 Replies)
Discussion started by: fastlane3000
11 Replies

7. Shell Programming and Scripting

Converting grep to awk

First, I am trying to search for certain string types within a very large file. Here is a sample record: MyCountry|MyGroup|MyCust|Run-Date|N/A|SERVER|OS|USERID|897//123456//LNAME FNAME|STATE|LLOGON In field 9 I am looking for invalid formats. A valid format would be 897/C/123456//LNAME FNAME.... (25 Replies)
Discussion started by: dagamier
25 Replies

8. Shell Programming and Scripting

Converting a line into a list using awk or sed

Hello, I am trying to convert a line into a list using awk or sed. Line: 345 897 567 098 123 output: 345 897 567 098 123 thanks (7 Replies)
Discussion started by: smarones
7 Replies

9. Shell Programming and Scripting

converting from reliant 2 solaris

Hello... I am trying to convert my script from one to another unix flavor... from reliant to solaris...I did all but can not convert this awk/nawk: First code if code that works what I want under reliant and the second should do same under solaris but it does not I did so far from this :... (2 Replies)
Discussion started by: abdulaziz
2 Replies

10. Solaris

converting midi to wav in solaris 10

how can i convert midi to wave in solaris 10 i have found timidity but it lack of documentation. is there any other suggestion? (1 Reply)
Discussion started by: conandor
1 Replies

Featured Tech Videos