tail -f logfile | grep org.springframework | cut -c 900-
would remove the first 900 characters
cut
uses 900- to show the 900th character to the end of the line
however when I pipe all of this through grep I don't get anything
I think awk
would be the best tool for this as it can both filter and perform the necessary string manipulation functions on filtered lines:
tail -f logfile | awk '/org.springframework/ {print substr($0, 6)}'
or
tail -f logfile | awk '/org.springframework/ && sub(/^.{5}/,"",$0)'
You can use cut
:
cut -c N- file.txt > new_file.txt
-c:
characters
file.txt:
input file
new_file.txt:
output file
N-:
Characters from N to end to be cut and output to the new file.
Can also have other args like: 'N' , 'N-M', '-M' meaning nth character, nth to mth character, first to mth character respectively.
This will perform the operation to each line of the input file.
sed 's/^.\{5\}//' logfile
and you replace 5 by the number you want...it should do the trick...
EDIT
if for each line
sed 's/^.\{5\}//g' logfile
Source: Stackoverflow.com