Search code examples
awktabular

AWK removes my spaces


I have a data like

31 text text t   text  ?::"!!/
2 te    text 32 +ěščřžý
43 te www  ##

It is output from uniq -c

I need to get something like

text text t   text  ?::"!!/
te    text 32 +ěščřžý
te www  ##

I tried to use something like

a=$1;
$1=""
$0=substr($0, 2);
printf $0;
print "";

But it removes me spaces and I got something like

text text t text ?::"!!/
te text 32 +ěščřžý
te www ##

And I need to save the number too.

Is there anyone, who knows how to do it?


Solution

  • I guess you want to remove the leading digits from each line, sed will be simpler for this task

    sed -E 's/^[0-9]+ //' file
    

    awk normalizes white space with the default FS. You can do the same with sub in awk if there is more processing.