0

I am trying to get file size of remote url in the following manner:

I am trying the below command:

curl -sI $url | grep -i content-length | cut -d ' ' -f 2

Its giving 17857797\C-M

I dont understand why \C-M is adding

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Santhosh
  • 9,965
  • 20
  • 103
  • 243
  • 1
    I suspect your '\C-M' is Control-M or carriage return character. – Bjoern Rennhak May 27 '18 at 14:14
  • 2
    The carriage return is "added" by [RFC 2616](https://tools.ietf.org/html/rfc2616), as each component of an HTTP response is *required* to end with a carriage-return/line-feed pair. – chepner May 27 '18 at 14:20

1 Answers1

0

Append | dos2unix or | tr -d '\r' to remove carriage-return.

Cyrus
  • 84,225
  • 14
  • 89
  • 153