Txt

Byte sized tech know-how.

  • Home
  • About

Tag Archives: for

25 May

Iterate a Text File in Bash

This is how you iterate thru a text file outputting a line at a time in Bash shell scripting.


IFS='\n'; for i in(cat FILE.TXT); do echo "$i"; done
admin Posted in Code, Command Line, Linux for, iterate, line, text 3 Comments
01 Dec

Import All MySQL Sql Dumps in a Folder

This command will import all the MySQL sql dumps in the current folder. You can use this to restore your backuped databases.


for i in *; do mysql -uroot `basename $i .sql` < $i;  done
admin Posted in Command Line, Linux backup, basename, command, database, dump, for, Linux, mysql, restore, sql, table Leave a comment
03 Jul

Fetch a URL With a Number Series

Use this command to download numbered content…


for ((i=1; i<9; i++)) ; do  wget "http://www.example.com/$i.txt" ; done
admin Posted in Command Line, internet, Linux command, download, for, Linux, number, url, wget 1 Comment
02 Jul

Zero Padding In Linux Commands

This is how you zero pad a numerical variable in bash.


for ((x=1;x<=31;x+=1)); do echo `printf "%02d" $x`; done

Original Article

admin Posted in Code, Command Line, Linux command, for, Linux, number, pad, padding, printf, zero Leave a comment

Post navigation

Categories

  • Code
  • Command Line
  • Configuration
  • CSS
  • HTML
  • internet
  • JavaScript
  • Linux
  • Mobile
  • Perl
  • PHP
  • Python
  • Ruby
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Fruitful theme by fruitfulcode Powered by: WordPress
↑