Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Brian_Deutmeyer
Collaborator
Jump to solution

R80.30 3.10 clish -f output contains ^M

Has anyone noticed hidden output (Processing line X out of Y ^M) when running the clish -f command from expert mode?  I noticed it on the R80.30 3.10 kernel when using clish -f somefile.txt.

 

1. I built a script:

[Expert@gw-name:0]# cat /tmp/script-to-get-asn.sh
set virtual-system 1
show configuration bgp

 

2. I run the script and get some output:

[Expert@gw-name:0]# /bin/clish -i -f /tmp/script-to-get-asn.sh 2> /dev/null | grep -E "set bgp external remote-as [0-9]+ on"
set bgp external remote-as 12345 on

 

3. I want to grab the ASN, but things get weird...


[Expert@gw-name:0]# /bin/clish -i -f /tmp/script-to-get-asn.sh 2> /dev/null | grep -E "set bgp external remote-as [0-9]+ on" | awk '{print $5}'
of

 

4. I save my output to a temp file and cat it... looks normal...


[Expert@gw-name:0]# /bin/clish -i -f /tmp/script-to-get-asn.sh 2> /dev/null | grep -E "set bgp external remote-as [0-9]+ on" > tmpfle
[Expert@gw-name:0]# cat tmpfle
set bgp external remote-as 12345 on

 

5. I look closer by doing a cat with a -v or vi the file and I see text that did show up earlier along with ^M...


[Expert@gw-name:0]# cat -v tmpfle
Processing line 2 out of 2 ^Mset bgp external remote-as 12345 on
[Expert@gw-name:0]#

 

What's going on here?

0 Kudos
1 Solution

Accepted Solutions
Brian_Deutmeyer
Collaborator

As a follow-up to this issue, a HF was created to fix this.  I've asked for the fixed to be included in a future jumbo.

View solution in original post

4 Replies
PhoneBoy
Admin
Admin
That seems to be...normal, as R80.20 with the 2.6 kernel also shows this behavior.
You can pipe it through sed to turn it into a proper linebreak.
Something like: /bin/clish -i -f /tmp/script-to-get-asn.sh 2> /dev/null | sed 's/^M/\n/'
Where the ^M is inserted with Ctrl-V Ctrl-M
0 Kudos
Brian_Deutmeyer
Collaborator

I'm not seeing it in R80.10, which is why I thought it was strange.  I did update my command to use sed to replace the junk characters where I'm wiping the ^M and anything before it... sed -e 's/^.*^M//'.  Just seems odd.

0 Kudos
PhoneBoy
Admin
Admin
I agree it's odd and it might be worth a TAC case to report the issue.
0 Kudos
Brian_Deutmeyer
Collaborator

As a follow-up to this issue, a HF was created to fix this.  I've asked for the fixed to be included in a future jumbo.

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events