The result have extra characters at front and end of every line.

This is a discussion on The result have extra characters at front and end of every line. within the shell forums in Operating Systems category; Hi, all: I ran the following command: # ll ../ | awk '{print $9}' | sort > filelist But it behaves differently in each system. File generated on Linux system: -rw-r----- 1 user asic 631 Aug 26 16:09 filelist File generated on Solaris system: -rw-r----- 1 user asic 402 Aug 26 16:11 filelist Using cat always sees correct result. But using vi to open filelist can see extra characters at front and end of every line if the file is generated in Linux, see below. How come? How to fix it? I need it to run correctly in both Linux and ...

Go Back   Database Forum > Operating Systems > shell

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-26-2008, 09:10 AM
Default The result have extra characters at front and end of every line.

Hi, all:

I ran the following command:
# ll ../ | awk '{print $9}' | sort > filelist
But it behaves differently in each system.

File generated on Linux system:
-rw-r----- 1 user asic 631 Aug 26 16:09 filelist

File generated on Solaris system:
-rw-r----- 1 user asic 402 Aug 26 16:11 filelist

Using cat always sees correct result. But using vi to open filelist
can see extra characters at front and end of every line if the file is
generated in Linux, see below. How come? How to fix it? I need it to
run correctly in both Linux and Solaris, in both csh and tcsh if
possible.

Thanks.

# cat filelist


Astro.setup
calibre.setup
compare_result_HERC_1_2.txt
compare_result.txt
curly_brace_lines.txt
curly_brace_pairs.txt
HERC_1
HERC_2
herc_debug.txt
icc.setup
ll.txt
processed_curly_brace_lines.txt
top_biranit.LAYOUT_ERRORS
top_biranit.LAYOUT_ERRORS_wrong
top_biranit_merge.LAYOUT_ERRORS
herc_drc_comp_0
herc_drc_comp_1
herc_drc_comp_2
herc_drc_debug
show_param
compare_result.txt_swap_file_check_folder

vi filelist


^[[00mAstro.setup^[[00m
^[[00mcalibre.setup^[[00m
^[[00mcompare_result_HERC_1_2.txt^[[00m
^[[00mcompare_result.txt^[[00m
^[[00mcurly_brace_lines.txt^[[00m
^[[00mcurly_brace_pairs.txt^[[00m
^[[00mHERC_1^[[00m
^[[00mHERC_2^[[00m
^[[00mherc_debug.txt^[[00m
^[[00micc.setup^[[00m
^[[00mll.txt^[[00m
^[[00mprocessed_curly_brace_lines.txt^[[00m
^[[00mtop_biranit.LAYOUT_ERRORS^[[00m
^[[00mtop_biranit.LAYOUT_ERRORS_wrong^[[00m
^[[00mtop_biranit_merge.LAYOUT_ERRORS^[[00m
^[[01;32mherc_drc_comp_0^[[00m
^[[01;32mherc_drc_comp_1^[[00m
^[[01;32mherc_drc_comp_2^[[00m
^[[01;32mherc_drc_debug^[[00m
^[[01;32mshow_param^[[00m
^[[01;34mcompare_result.txt_swap_file_check_folder^[[00m
Reply With Quote
  #2  
Old 08-26-2008, 09:40 AM
Default Re: The result have extra characters at front and end of every line.

On Tuesday 26 August 2008 14:10, Kuhl wrote:

> Hi, all:
>
> I ran the following command:
> # ll ../ | awk '{print $9}' | sort > filelist
> But it behaves differently in each system.
>
> File generated on Linux system:
> -rw-r----- 1 user asic 631 Aug 26 16:09 filelist
>
> File generated on Solaris system:
> -rw-r----- 1 user asic 402 Aug 26 16:11 filelist
>
> Using cat always sees correct result. But using vi to open filelist
> can see extra characters at front and end of every line if the file is
> generated in Linux, see below. How come? How to fix it? I need it to
> run correctly in both Linux and Solaris, in both csh and tcsh if
> possible.


ll is an alias or function. What's the command it actually runs?
It looks like in linux it produces a colorized listing, and the ansi escape
sequences are incorrectly included in the resulting file.


--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
Reply With Quote
  #3  
Old 08-29-2008, 10:36 AM
Default Re: The result have extra characters at front and end of every line.

Hi, thanks for the solution. :-)
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 01:02 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.