Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by micotao

  1. micotao

    How to decode such characters for a string or file content

    Hi, xmb: Thanks for your help. There is a related question about \ backslash escape impact in a string: How can I understand these two output, the different \ numbers,but the same result: under KSH # printf "%s" "This is\nThat is" This is\nThat is # printf "%s" "This is\\nThat...
  2. micotao

    How to set the "From:" field value on demand in Sendmail?

    Hi, All: When we use mailx command to send email to some specific email address, can we configure the "From:" field value? I mean, by default, the recipients will see the From: as root@<host>.<domain>, but can this be configured on our demand? Say, we don't want it to be displayed as...
  3. micotao

    Can &quot;From:&quot; field be configured on demand in Sendmail?

    Hi, All: When we use mailx command to send email to some specific email address, can we configure the "From:" field value? I mean, by default, the recipients will see the From: as root@<host>.<domain>, but can this be configured on our demand? Say, we don't want it to be displayed as...
  4. micotao

    How to decode such characters for a string or file content

    Hi, xmb: Can you help with the usage about gsub( which has the same behaviour as sub) and the split? Because I don't know how many times and how the backslash '\' will be processed? I really feel confused by the \ backslash in the string or some file content. Thanks very much in...
  5. micotao

    How to decode such characters for a string or file content

    Hi, xmb: Thank you very much. I will take time to investigate your code and raise comments soon. Hi, PHV: Thank you a lot. I use nawk, and it works. Thanks xmb for reminder too.
  6. micotao

    How to decode such characters for a string or file content

    Hi, xmb: Thank you very much. I will take time to investigate your code and raise my comments. Hi, PHV
  7. micotao

    How to decode such characters for a string or file content

    Hi, PHV: This is what I done to test the code from you. I wrote a ksh script which comes from your code directly.But I got the following output error: + awk { split("\\\\\\\\1a,\\\\\\\\7b,\\\\\\\\7d",from,",");split("\\n,{,}",to,","); N=3 }{ for (i=1;i<=N;++i)...
  8. micotao

    How to decode such characters for a string or file content

    Hi, PHV: Thanks for your valuable instruction. I am still trying to understand your code. But during my testing for trial of the following code: # echo "This is\\\\\\\\1aThat is" | tr '\\1a' "\n" This is 1aThat is Can you tell me why that is the output result? As I want to...
  9. micotao

    How to decode such characters for a string or file content

    Hi, All: Suppose this is the file content I have, and I need to do some "translation" to specific characters.File content or some string like this: This is a decoding process. We have to do this.\\1aWe need \\7b CHANGE \\7d. The characters that need decoding are: '\\1a' ----> '\n' '\\7b'...
  10. micotao

    How to use Array and Arithmetic for in KSH?

    Hi,all: Please look at the following ksh script. #!/bin/ksh set -A name 1 2 3 4 5 NUM_MAX=5 for ((i = 0; i <= NUM_MAX-1; i++)) do echo ${A[$i]} done I can't see obvious errors, but in fact, I got the following syntax error reporting: ./test[4]: syntax error at line 4 : `((' unexpected...
  11. micotao

    How to extract some lines from one file to output to another file

    xmb: Thanks for your valuable help.
  12. micotao

    How to extract some lines from one file to output to another file

    Hi, If I want to extract the contents of one file, from its line 3 to its line 15( suppose it has 100 lines). Which commands can I use to function this? I only know how to extract the first N lines from one file to output to another file, say: head -16 somefile > otherfile Thanks for your...
  13. micotao

    To truncate one input file content to a fixed length?

    Hi, maltais: Thanks for your comments. But the usage you described is aimed to pass the first 160 characters of each line, instead of the first 160 characters of the file1, so it is not what we want. Do you have any further comments? Thanks.
  14. micotao

    To truncate one input file content to a fixed length?

    Hi, PHV: Thanks for your help. "dd" can perform the work. And I think there is another same kind question here. If we want to truncate a string to a fixed length. Say, there is a 500 characters long string1, we want to keep the first 160 characters and assigned it to another string2 if we...
  15. micotao

    To truncate one input file content to a fixed length?

    Hi, PHV: Thanks for your reply. Yes, My mistake, I should use printf. But now, I even got the wrong result, it insert a blank line between the original lines,which is not what I want. I want to read in the content of the original file, keep its format unchanged, and just read in 160...

Part and Inventory Search

Back
Top