Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the awk command to connect a string in linux

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to use the awk command to connect strings in linux. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. Converting awk strings to numbers

[chengmo@centos5 ~] $awk 'BEGIN {a = "100"; b =" 10test10 "; print (a+b+0);}'

one hundred and ten

You just need to operate the variables through a "+" connection. Automatically forces strings to be converted to integers. When a non-numeric character becomes 0, the first non-numeric character is found and automatically ignored later.

II. Awk numbers are converted into strings

[chengmo@centos5 ~] $awk 'BEGIN {axiom 100 per Bourne C = (a "" b); print c}'

100100

You just need to connect the variable to the "" symbol to operate.

3. Awk string concatenation operation

[chengmo@centos5 ~] $awk 'BEGIN {a = "a"; b = "b"; c = (a "" b); print c}'

Ab

[chengmo@centos5 ~] $awk 'BEGIN {a = "a"; b = "b"; c = (aqb); print c}'

0

String concatenation operations pass through the "two" and "+" operators. The mode forces the values on the left and right sides to be numeric. And then do it.

The above is how to use the awk command to connect strings in linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report