Adding new line character

Hi All,

i am taking end of records using tail command got the out is "END OF FILE. ROW COUNT: 10"
and record count in the file is 3. while append the both data into test2.txt file,it's append like

END OF FILE. ROW COUNT: 108

my output should be in the test2.txt file

 END OF FILE. ROW COUNT: 10,8 

i tried like...

tail -1 test1.txt > test2.txt;
wc -l test1.txt| awk '{print $1-1}' >>test2.txt;

Please help me..

Thanks,

What are you trying to achieve? Do you want last line and no of line of test1.txt ?

While appending the second command using wc to add ",8 " it means record count of the file

 END OF FILE. ROW COUNT: 10,8

Do you mean this?

awk 'END{print $0,NR}' OFS=, test1.txt

yes,how to add the file count to after tailing...

---------- Post updated at 06:02 AM ---------- Previous update was at 05:58 AM ----------

Thanks got... it's working fine.. i need one more while taking the file count it is blank lines.. how to exclude...

i tried with huge file as given command it' not working...if we tried with big file working fine.

awk 'END{print $0,NR}' OFS=, test1.txt

if it is big file

 ,1326543

but end of file record as like

 END OF FILE. ROW COUNT: 1326542 

i am excepting is

 END OF FILE. ROW COUNT: 1326542,1326543 

Thanks lot...

Post the output of last 10 lines of the BIG file.

tail BIG_file

Also, Are you sure the BIG file is a valid unix file. (doesn't contain invalid \r)

d2d75796-3643-4ff7-907d-364da0cb265f|20090508911|0|0|0|1000003907519
|20090509316|0|0|0|1000015538346| |Sierra|J|Castedo Rodgers
657eb9dc-536c-4528-b7dd-460ef8cf7c46|20090603702|250|0|0|1000014950343
402ad435-7cd4-4e45-b779-decb0de42db6|20090603982|250|0|0|1000000009808
|20090604343|250|0|0|1000015548013| |Alton| |Anderson| |273 krystle
60afc667-ce71-4543-adcd-2c4224fb51a9|20090604354|250|0|0|1000006312304
240dc881-b7b3-4486-b0c1-aa51344fb3dd|20090902893|0|0|0|1000004791203| 
|20090902926|0|0|0|1000008004140| |Karen| |Johnston| |75 Laxalt Dr| |
289b6a7f-ff77-4964-b447-83c759a83028|20091203344|0|0|0|1000015599379|
END OF FILE. ROW COUNT: 1326542

Are you sure this format is correct and nothing wrong with the file?
Again, Did you took it from a non-unix system (windows)?
check and post the o/p of the below command

tail file | sed l

Check now...

d2d75796-3643-4ff7-907d-364da0cb265f|20090508911|0|0|0|1000003907519| |\
Evelyn| |Valdez| |2802 Jadewood Ct| |||Austin|TX|78748-5360|20120511|N
d2d75796-3643-4ff7-907d-364da0cb265f|20090508911|0|0|0|1000003907519| |Evelyn| |Valdez| |2802 Jadewood Ct| |||Austin|TX|78748-5360|20120511|N
|20090509316|0|0|0|1000015538346| |Sierra|J|Castedo Rodgers| |210 W 38T\
h St|# 10|||Austin|TX|78705-1445|20120511|Y
|20090509316|0|0|0|1000015538346| |Sierra|J|Castedo Rodgers| |210 W 38Th St|# 10|||Austin|TX|78705-1445|20120511|Y
657eb9dc-536c-4528-b7dd-460ef8cf7c46|20090603702|250|0|0|1000014950343|\
 |Meranda|ann|Simmons| |6804 Pierce St| |||Norfolk|VA|23513-3028|201205\
11|N
657eb9dc-536c-4528-b7dd-460ef8cf7c46|20090603702|250|0|0|1000014950343| |Meranda|ann|Simmons| |6804 Pierce St| |||Norfolk|VA|23513-3028|20120511|N
402ad435-7cd4-4e45-b779-decb0de42db6|20090603982|250|0|0|1000000009808|\
 |Kenneth|John|Obrien| |5372 El Dorado Dr| |||Huntington Beach|CA|92649\
-4566|20120511|N
402ad435-7cd4-4e45-b779-decb0de42db6|20090603982|250|0|0|1000000009808| |Kenneth|John|Obrien| |5372 El Dorado Dr| |||Huntington Beach|CA|92649-4566|20120511|N
|20090604343|250|0|0|1000015548013| |Alton| |Anderson| |273 krystle loo\
p| |||sagle|ID|83860|20120511|Y
|20090604343|250|0|0|1000015548013| |Alton| |Anderson| |273 krystle loop| |||sagle|ID|83860|20120511|Y
60afc667-ce71-4543-adcd-2c4224fb51a9|20090604354|250|0|0|1000006312304|\
 |Lisa| |Blake| |809 Mallard Creek Ct| |||Roseville|CA|95747-4653|20120\
511|N
60afc667-ce71-4543-adcd-2c4224fb51a9|20090604354|250|0|0|1000006312304| |Lisa| |Blake| |809 Mallard Creek Ct| |||Roseville|CA|95747-4653|20120511|N
240dc881-b7b3-4486-b0c1-aa51344fb3dd|20090902893|0|0|0|1000004791203| |\
Doniel| |Henderson| |3024 Ambarwent Rd| |||Reynoldsburg|OH|43068-8223|2\
0120511|N
240dc881-b7b3-4486-b0c1-aa51344fb3dd|20090902893|0|0|0|1000004791203| |Doniel| |Henderson| |3024 Ambarwent Rd| |||Reynoldsburg|OH|43068-8223|20120511|N
|20090902926|0|0|0|1000008004140| |Karen| |Johnston| |75 Laxalt Dr| |||\
Carson City|NV|89706-7763|20120511|Y
|20090902926|0|0|0|1000008004140| |Karen| |Johnston| |75 Laxalt Dr| |||Carson City|NV|89706-7763|20120511|Y
289b6a7f-ff77-4964-b447-83c759a83028|20091203344|0|0|0|1000015599379| |\
Maria| |Vishnevskiy| |121 Granite Hill Ct| |Pmb|10|Langhorne|PA|19047-1\
017|20120511|N
289b6a7f-ff77-4964-b447-83c759a83028|20091203344|0|0|0|1000015599379| |Maria| |Vishnevskiy| |121 Granite Hill Ct| |Pmb|10|Langhorne|PA|19047-1017|20120511|N
END OF FILE. ROW COUNT: 1326542
END OF FILE. ROW COUNT: 1326542