[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scripting help
From: |
Andreas Schwab |
Subject: |
Re: scripting help |
Date: |
Tue, 25 Sep 2007 23:20:45 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) |
suser <spinegar@gmail.com> writes:
> I am trying to create a script to go through /etc/passwd and change anyone
> who's home directory is "/mnt/home" to "/mnt/<username on linux server>".
This does not really has anything to do with bash, let alone with bugs
in bash, so it is rather off-topic here.
> Original - user:x:1000:100:user:/mnt/home:/bin/bash
>
> what i want - user:x:1000:100:user:/mnt/user:/bin/bash
>
> any suggestions? thanks in advance!
$ awk -F: '$6 == "/mnt/home" { $6 = "/mnt/" $1 }' < input > output
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."