remove first two bytes of a line
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.
I tried sed
, awk
, cut
but none of them work (though they work in vi
mode):
sed 's/^.,2//' file.dat
awk 'print substr($0,3)' file
cut -c3- file
Example:
<84>^cColumn1,Column2
x^CColumn1,Column2
v^CColumn1,Column2
<81>^CColumn1,Column2
Desired Output:
Column1,Column2
Column1,Column2
Column1,Column2
Column1,Column2
text-processing
New contributor
add a comment |Â
up vote
1
down vote
favorite
I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.
I tried sed
, awk
, cut
but none of them work (though they work in vi
mode):
sed 's/^.,2//' file.dat
awk 'print substr($0,3)' file
cut -c3- file
Example:
<84>^cColumn1,Column2
x^CColumn1,Column2
v^CColumn1,Column2
<81>^CColumn1,Column2
Desired Output:
Column1,Column2
Column1,Column2
Column1,Column2
Column1,Column2
text-processing
New contributor
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.
I tried sed
, awk
, cut
but none of them work (though they work in vi
mode):
sed 's/^.,2//' file.dat
awk 'print substr($0,3)' file
cut -c3- file
Example:
<84>^cColumn1,Column2
x^CColumn1,Column2
v^CColumn1,Column2
<81>^CColumn1,Column2
Desired Output:
Column1,Column2
Column1,Column2
Column1,Column2
Column1,Column2
text-processing
New contributor
I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.
I tried sed
, awk
, cut
but none of them work (though they work in vi
mode):
sed 's/^.,2//' file.dat
awk 'print substr($0,3)' file
cut -c3- file
Example:
<84>^cColumn1,Column2
x^CColumn1,Column2
v^CColumn1,Column2
<81>^CColumn1,Column2
Desired Output:
Column1,Column2
Column1,Column2
Column1,Column2
Column1,Column2
text-processing
text-processing
New contributor
New contributor
edited 6 mins ago
sddgob
16.3k102564
16.3k102564
New contributor
asked 6 hours ago
ranjan
62
62
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
Using cut
:
cut -b 3- infile
This will cut the first 2 bytes from each line or print from 3rd byte to end of line.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Using cut
:
cut -b 3- infile
This will cut the first 2 bytes from each line or print from 3rd byte to end of line.
add a comment |Â
up vote
2
down vote
Using cut
:
cut -b 3- infile
This will cut the first 2 bytes from each line or print from 3rd byte to end of line.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Using cut
:
cut -b 3- infile
This will cut the first 2 bytes from each line or print from 3rd byte to end of line.
Using cut
:
cut -b 3- infile
This will cut the first 2 bytes from each line or print from 3rd byte to end of line.
answered 6 hours ago
sddgob
16.3k102564
16.3k102564
add a comment |Â
add a comment |Â
ranjan is a new contributor. Be nice, and check out our Code of Conduct.
ranjan is a new contributor. Be nice, and check out our Code of Conduct.
ranjan is a new contributor. Be nice, and check out our Code of Conduct.
ranjan is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476392%2fremove-first-two-bytes-of-a-line%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password