i know , the below question has been repeated.
can you guys guide me .
I have the below input
999999 xxxxxxxxxxxxxx 123.45 2013-05-02 08:14 1 1 1 xxxx
999999 xxxxxxxxxxxxxx 123.45 2013-06-02 02:14 1 4 1 dddd
i need to remove from the column 54 to 70 , as like the below output.
999999 xxxxxxxxxxxxxx 123.45 1 1 1 xxxx
999999 xxxxxxxxxxxxxx 123.45 1 4 1 dddd
thanks in advance ! ! !
Yoda
May 8, 2013, 11:02am
2
sed 's#[1-9][0-9][0-9][0-9]-.*:[0-9][0-9] ##g' file
joeyg
May 8, 2013, 11:05am
3
something like: cut -f1-3,6-9
$ echo 999999 xxxxxxxxxxxxxx 123.45 2013-05-02 08:14 1 1 1 xxxx | cut -d" " -f1-3,6-9
999999 xxxxxxxxxxxxxx 123.45 1 1 1 xxxx
It can also be done either of the below way:
awk '{print $1 " " $2 " " $3 " " $6 " " $7 " " $8 " " $9}' file
awk '{$4=" "; $5=" "; print}' file
Is this what you were looking for?
1 Like
clx
May 8, 2013, 11:15am
5
Please elaborate. The strings you want to remove are not column 54 to 70.
joeyg
May 8, 2013, 11:18am
6
Your example text did not appear to have 70+ columns. My count showed 56 characters across.
Since the default value of OFS is a space, you do not need to explicitly concatenate.
print $1, $2, $3, $6, $7, $8, $9
Regards,
Alister
Thanks alister
Just started learning AWK !
i need the character to cut from 38 to 54.
and also i cannot use awk since it the second column"xxxxxxxxxxxxxx " will have special character or space..
---------- Post updated at 09:47 PM ---------- Previous update was at 09:41 PM ----------
thanks guys, ihave finally achived it using the substr command, which i have forgot earlier
awk '{print substr($0,1,38),substr($0,55,90)}'
The simplest solution is right there in your post. Hint:
Regards,
Alister