Can't understand the script

I am relatively new to Shell Scripting. I can't understand the following two scripts. Can someone please spare a minute to explain?

1) content s of file a are

(021) 654-1234

sed 's/(//g;s/)//g;s/ /-/g' a
021-654-1234

2)

cut -d: -f1,3,7 /etc/passwd |sort -t: +1n

gives error

sed 's/(//g;s/)//g;s/ /-/g' a
021-654-1234

The above is a sed command with three functionalities

1) s/(//g; to substitute "(" with nothing
2)s/)//g; to substitute ")" with nothing
3) s/ /-/g to substitute " ' with -

the flag "g" stands for globally that is for eg: if they are 1 or more instances of ( all will be replaced

Regarding 2nd cmd what is the error it throws ?

HTH,
PL

thanks.. I couldn't see the ';' in the 1st script. Too much stuffs in it scared me, I guess.

2nd cmd give the following error-

sort: open failed: +1n: No such file or directory

Seems like the syntax is incorrect in this command:

$
$ cut -d: -f1,3,7 /etc/passwd |sort -t: +1n
sort: open failed: +1n: No such file or directory
$

As can be seen by the following:

$
$ sort -t: +1n /etc/passwd
sort: open failed: +1n: No such file or directory
$

If you want to sort the output (numerically) by the 2nd field, which is the 3rd field in the original /etc/passwd file, then -

cut -d: -f1,3,7 /etc/passwd | sort -t: -k2,2n

tyler_durden