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

Summary of Seq commands

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Summary of Seq commands

Example 1:

# seq 1 10

The result is 1 23 4 5 6 7 8 9 10

Example 2:

#! / bin/bash

For i in `seq 1 10`

Do

Echo $I

Done

Or use

For i in $(seq 1 10)

Also OK

Seq

-fmam Murtel formatting format use printf style floating-pointFORMAT (default:% g)

-s,-- separator=STRING use STRINGto separate numbers (default:\ n)

-W,-- equal-width equalize width by padding with leading zeroes

The-f option specifies the format

# seq-f "% 3G" 911

nine

ten

eleven

The number of digits specified after% defaults to "% g"

"% 3G" then the insufficient number of digits is a space.

In the case of # sed-f "g" 9 / 11, the underdigits are 0.

% set the string before

Seq-f "strg" 9 11

Str009

Str010

Str011

-w specifies that the output digit is the same width and cannot be used with-f

Seq-w-f "strg" 9 11

Seq: format string may not be specified whenprinting equal width strings

Seq-w 98 101

098

099

one hundred

one hundred and one

The output is the same width.

-s specifies that the delimiter defaults to enter

Seq-s ""-f "strg" 9 11

Str009 str010 str011

To specify\ t as the separator

Seq-s "`echo-e"\ t "`" 911

Specify\ n\ nas the separator

Seq-s "`echo-e"\ n\ n "`" 911

19293949596979899910911

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

Network Security

Wechat

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

12
Report