Afficher un message
Vieux 22/08/2006, 14h00   #2
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ned to append 2nd line to the first

cberthu@gmail.com wrote:
> Hi all,
>
> Sorry to bother but I am a rookie and got this to do.
> I need to format this output :
> "************************************************* ***********************"
> S_PASSWD_READ patrol3 OK Sat Aug 19 09:30:03 2006 db2
> audit object read event detected /etc/security/passwd
> S_PASSWD_READ patrol3 OK Sat Aug 19 09:30:03 2006 db2bp
> audit object read event detected /etc/security/passwd
> S_PASSWD_READ patrol3 OK Sat Aug 19 09:30:03 2006 db2bp
> audit object read event detected /etc/security/passwd
> S_PASSWD_READ patrol3 OK Sat Aug 19 09:30:03 2006 db2bp
> audit object read event detected /etc/security/passwd
> S_PASSWD_READ patrol3 OK Sat Aug 19 09:30:03 2006 db2bp
> audit object read event detected /etc/security/passwd
>
> "************************************************* ***********************"
>
> So that the 2nd lined is append to the first till the end of the
> output.
>
> I got the input file into a arry and I block somehow now...
> ************************************************** **********************
> if [ "$#" -eq "0" ]
> then
> echo "==> Please give the full path for the incoming file"
> read INPUT
> echo "Your answer was" $INPUT
> fi
> file_name=$INPUT
> i=0
> while read file_line
> do
> line_array[i]=${file_line}
> echo "This is the line:" $file_line
> echo $file_line >> /u/t315511/scripts/chris.out
> if [ "^$file_line" = " " ]
> then
> echo "Here is one " $file_line
> fi
> let i=${i}+1
> done < ${file_name}
> echo ${line_array[@]}
> ************************************************** **********************
>


awk 'NR%2{s=$0;next}{print s$0}' file

Ed.
  Réponse avec citation
 
Page generated in 0,06295 seconds with 9 queries