Hi to everybody
i stuck on a simple thing i had a string and i want cut it , i try already few thing with the cut command but does not the way it should.
The script is in csh and running on AIX 4.3.2.0
The string should be cut always after the 7. delimiter even if there are no number between two delimiters like in sample 1 and 2 . That maybe the reason it doesnot works with the cut command.
You probably didn't interpret the returned empty string as a result, like i did above in the little proof of concept.
Anyway, i strongly suggest you stop using csh and start using a less bugridden shell. AIX 4.3.2 (you might want to consider updating this to 4.3.3 ML12 too) offers a ksh88 and a ksh93.
This has no benefits over cut if that's all you're doing... but if you're doing 93 more transformations on the data before you're done with it, they could all be rolled up in one awk call instead of 93 more shell externals.
Yes you are right the same string was in the other thread and your solution works perfect .
the cut on the string has to done every Iteration the change of the bit only has to done depending on some condition.
But the solution for the cut does not works on my side
The routine is always the same: please post some sample of your input and a terminal session with some command executed on this data and its oucome: error messages, return codes, diagnostics and whatever is there.
Something like this:
I can't seem to make the ls -command work:
root@system # ls -l /bla/foo/file
/bla/foo/file not found
root@system # echo $?
2
Such a transcript i can analyse and would tell you that you probably mistyped the filename or some part of its path name. Telling me just " ls -l didn't work" i wouldn't be able to tell you anything.
I guest i found the reason why the cut and awk doesn't work on my Project.
The file has only one line with without an CR.
If i just add an CR to this line both cut and awk works as from you recommented.
My Problem now the other process which create this text file will not add an CR to the this line
I'll Play around , hopefully i will found a solution for it
But this will produce an extra empty line if the input file is complete.
--
BTW the cut command in AIX 5.1 can handle an incomplete line.
Another method that might work in AIX 4.x:
hmm, now you got me interested in what exactly is the content of this file.
You got already various (and valuable) suggestions from my colleagues. My suggestion is, however, to spare us the guessworks and do the following: execute the shown command on the file and its output:
# cat /path/to/your/file | od -ax
<...output of the command here...>
The reason for this is that maybe some other "non-standard" traits of the file might include invisible characters and similar things that might confuse used commands. The output will make them visible (if they exist at all).