Append your messaage in UNIX command

Hi All,

I am executing this command to capture all the outputs from Error_*.txt files to all.txt file as a single output.

head -n -5 Error_*.txt > all.txt

It gives me the output in all.txt as:

==> ErrorLog_batchSearch.txt <==
2014-03-09 17:07:28,193 ERROR [nucleusNamespace.] Cannot parse property value "null" of 

==> ErrorLog_content.txt <==

==> ErrorLog_lockServer.txt <==

==> ErrorLog_mobile.txt <==

Now I want to append some Message after every

==> ErrorLog_content.txt <==

in the same line as :

==> ErrorLog_content.txt <==  Here are the errors:

Can somebody please help me on this.

Thanks

Try

sed 's/==> ErrorLog_content.txt <==/& Here are the errors:/' file

The file output is as:

==> ErrorLog_batchSearch.txt <==
2014-03-09 17:07:28,193 ERROR [nucleusNamespace.] Cannot parse property value "null" of "/atg/commerce/order/abandoned/AbandonedOrderService.schedule" as a atg.service.scheduler.Schedule java.lang.IllegalArgumentException: atg.nucleus.PropertyValueParseException: Invalid Schedule format

==> ErrorLog_content.txt <==

==> ErrorLog_dataLoader.txt <==

==> ErrorLog_fulfillment.txt <==

==> ErrorLog_liveSearch.txt <==

==> ErrorLog_lockServer.txt <==

How to append lines in after every :

==> ErrorLog_*.txt <== : My line here

You need to give us more clarity. What message do you want to append after every ErrorLog_*.txt? Is the message same or is it different?

Message would be a static line like : The errors are:

awk '/ErrorLog_*.txt/{$0=$0 " The errors are:"} 1' infile
sed 's/.*ErrorLog_.*txt.*/& The errors are:/'

Thanks Ahamed.

I am also facing another problem. I have a list of files and they contain errors. I am concatenating all of them by this command:

cd /temporary/
    head -n -500 ErrorLog_*.txt > all.txt

and then seeing the all.txt output as:

==> ErrorLog_batchSearch.txt <==

==> ErrorLog_content.txt <==

==> ErrorLog_fulfillment.txt <==

==> ErrorLog_service.txt <==

Why it is skipping the lines. The ErrorLog_* are not empty!

---------- Post updated at 01:29 AM ---------- Previous update was at 01:25 AM ----------

I tried with this:

  head -n -1 ErrorLog_*.txt > all.txt

But

==> ErrorLog_content.txt <==

==> ErrorLog_fulfillment.txt <==

they are printed as empty though they have a single line inside them!!

---------- Post updated at 01:38 AM ---------- Previous update was at 01:29 AM ----------

Solved by this

head -n999999