generating line numbers

hello All

Do anybody know how to generat number line
that is puting the number of lines at the begining of a new line, with d bracket by the side
say
1)
2)
3)

any help would be nice

The "Similar Threads" at the bottom of this page would be a good place to start. (Too bad the forums don't display that until you have posted your question.)

I kjnow the cat -n works but puting the ) after each number line is complicated bit

cat -n "$file" | sed -e 's/^ *[1-9][0-9]*/&)/'

The regular expression matches start of line, zero or more spaces, and a nonzero positive integer, and sed replaces any match with whatever matched (& is the "magic" character which does this) and a right parenthesis.

Actually this is probably easier in awk.

awk '{ print NR ") " $0 }' "$file"

NR is the current line number and $0 is the input line.

sed = a | sed 'N; s/^/     /; s/ *\(.\{6,\}\)\n/\1)  /'

sed1line

nl -s\)\  -w1 file

any other way without the sed and awk plssss

Why? This isn't homework, is it?

nl file |
while read no line; do
  echo "$no)" "$line"
done