I have MKS Toolkit (K-Shell) running on a windows server. On it I have a c program that in a true unix environment works fine, but here it adds an extra '0000000000000016000A' in various places in the file that the c program produces that I need to remove.
Here is what the file looks like when I pg it:
Note that the length of the line exceeds the width of the screen and pg simply does not display the rest of the line; this file shows 17 very long lines.
From the windows environment, here is what it looks like when I use notepad:
So I have tried sed:
and I get a zero byte new.OUT. I have tried this identical sed command on a simple text file where I put '00123' strewn throughout and it worked fine.
I tried awk:
and I get this message:
I tried using tr, but I could only ever get it to work on a character by character basis, so when I asked for it to delete '0000000000000016000A' it also removed all instances of the numbers 0,1,6 and the letter A.
Can anyone here think of a way to remove these errant entries from this file that has long lines?
Hello,
I am trying to create an iptables script with tail ,sed and awk.
1st Request: Search keyword "secret" in access.log file
2nd Request: Get first column matching lines (ip address)
3rd Request: Save it to a file
This is what I did so far:
grep.sh
#!/bin/bash
while true;
do
tail... (23 Replies)
Hi,
I'm trying make a variable length file to a fixed length of 4000.
I'm to pad spaces on the right of a record if length is less than 4000 to make the record length 4000.
I'm trying to use the below commands
awk '{printf "%-4000s\n", $0}' inputfile.dat > outputfile.dat
sed -e :a... (12 Replies)
All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed...
I have an input file similar to:
&LOG
&LOG Part: "@DB/TC10000021855/--F"
&LOG
&LOG
&LOG Part: "@DB/TC10000021852/--F"
&LOG Cloning_Action: RETAIN
&LOG Part: "@DB/TCCP000010713/--A"
&LOG
&LOG... (5 Replies)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
My input file gfile values is CTRY=GM&PROJTYPE=SP&PROJECTTYPE=Small+Project
If i am giving PROJECTTYPE then it must give Small Project
awk -F"&" '{for (i=1; i<=NF; i++) if ($i ~ "^"PAT) {sub ("^"PAT"=", "", $i); sed 's/'+'/""/' $i ; print $i }}' PAT=$1 ... (6 Replies)
I get a file which has all its content in a single row.
The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file.
I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
hello
i try this command in console mode
sed -e :a -e '/$/N; s/\(\)\n/\1 /; ta' test.txt > result.txt
i have in the output screen "Output line too long" for multiples lines
can you please tell me how can i retrieve those long lines during the execution ?
Another thing very... (5 Replies)
I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one:
User1NameLast User1NameFirst User1Address
E-Mail:User1email
User2NameLast User2NameFirst User2Address... (11 Replies)
Hello,
I have a logfile which is in this format:
1211667249500#3265
1211667266687#2875
1211667270781#1828
Is there a way to read the logfile line by line every time I execute the code and put the two numbers in the line in two separate variables?
Something like:
1211667249500#3265... (7 Replies)