LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs > Linux Gimux
User Name
Password

Notices


An occasional blog about my recently discovered Linux gems!
Rate this Entry

File manipulation from the command line

Posted 11-03-2015 at 07:12 AM by myklmar

TEXT COMMANDS

To create file :: 'cat > (file name)'

After pressing Enter, you are not returned to the prompt. Instead, the cursor is placed on the next line, allowing you to enter text into your file. Type your lines of text, pressing Enter after each one.
When you are done, press Ctrl + D to exit the file and return to the prompt.

To verify file creation :: 'ls -l (file name)'

To view file :: 'cat (file name)'

To view files side by side :: ' paste file1.txt file2.txt file3.txt'

To add to a file :: 'echo (information) >> file1.txt

To create a new file with file1.txt file2.txt contents :: 'cat file1.txt file2.txt > newfile.txt '

To sort into alphabetical order :: 'sort file1.txt'

To sort into reverse order :: 'sort -r file1.txt'

To overwrite contents :: ' echo (new info) > file1.txt

To replace a word in the sentence :: ' sed s/word/newword/ file1.txt
Posted in Uncategorized
Views 1994 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 03:30 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration