i have problem to show specific text. Example i will get only version number from text in file version.txt this: Version = "0.11.0"
can someone help me?
thanks
You want just the numbers?
Perhaps
awk -F\" '/Version/ {print $2}' version.txt
You can simply use cut
:
cat version.txt | cut -d '=' -f2 | xargs
Or awk
as others suggested:
cat version.txt | awk '{print $3}'
Both output: 0.11.0
The logic is based on the file format being consistent rather than focusing on the number extraction.
cut
: prints the value after =
| xargs
: trims spaces awk
: prints the value on third place
These allow for example both xxx and xxx-RELEASE
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.