Sponsored Content
Full Discussion: Edit files with cat
Top Forums UNIX for Dummies Questions & Answers Edit files with cat Post 302492240 by scarleo on Sunday 30th of January 2011 04:08:26 PM
Old 01-30-2011
Edit files with cat

Hi, sometimes one wants to edit files while still seeing output of earlier commands in terminal. I've found out that cat test && cat - >> test does the trick for displaying file content and adding lines but I believe I saw a much cooler command that was also able to erase lines from files. I cannot find that site again. Could someone here please enlighten me? Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to edit large files using vi

How to edit large file using vi where you can't increase /usr/var/tmp anymore? (3 Replies)
Discussion started by: nazri
3 Replies

2. UNIX for Dummies Questions & Answers

Edit Multiple Files in VI

Here's what I have... $ vi foo1 - open foo1 and work around for a while. I yank a few lines into a buffer and then :w to save. Next I :e foo2 to open foo2 and paste my buffer. I :w to save, but I would like to then be able to go directly back into foo1 where I was before I opened foo2. ... (4 Replies)
Discussion started by: djschmitt
4 Replies

3. UNIX for Dummies Questions & Answers

cat files

Hi, I was a typical Windows guy. Like to do things just by clicking my mouse:cool:. I got a new job now...where they are big on unix. I am trying to wet my fingures now with unix. Haven't taken the dive yet. I am trying to find a solution for this problem. Please help me with some... (4 Replies)
Discussion started by: sandeep78
4 Replies

4. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

5. HP-UX

cpio.cat.z files????

what are cpio.cat.z files??? Can I delete them??? (3 Replies)
Discussion started by: ldaliosmane
3 Replies

6. Shell Programming and Scripting

cat certain files in directories to files named after the dir?

Hi all, I have a directory with many subdirectories each named like so: KOG0001, KOG0002, ...KOG9999. Each of these subdirectories contain a variable number two kinds of files (nuc and prot) named like so: Capitella_sp_nuc_hits.fasta (nuc) and Capitella_sp_prot_hits.fasta (prot). The... (2 Replies)
Discussion started by: kmkocot
2 Replies

7. UNIX for Dummies Questions & Answers

edit _config files

Hi, I am trying to edit sshd_config file through the vi editor. logged on as a root. when I try to write the file I get: Read-only file, not written; use ! to override when i type :w!, I get: Error: etc/ssh/sshd_config Permission denied. I want to change: #PermitRootLogin no to yes freeBDS... (6 Replies)
Discussion started by: emosms
6 Replies

8. UNIX for Dummies Questions & Answers

Using cat on specific files only

I am concatenating txt-files using cat: cat *.txt > file.dat However, the same directory has the installation instructions included, which is also a txt file: install.txt I currently have the install.txt file renamed to install._txt, but I prefer a solution using regular expressions. Is there... (5 Replies)
Discussion started by: figaro
5 Replies

9. Shell Programming and Scripting

Cat N files in a folder

I am new to Linux and I am trying to cat only N files in a folder. N is dynamically given number at runtime. If I give N as 2 then cat only 2 files in the folder and If I give N as 5 then cat only 5 files in the folder. Is there any way to do that? (6 Replies)
Discussion started by: KMusunuru
6 Replies

10. Shell Programming and Scripting

Gunzip and edit many files

Experts - I have an requirement to gunzip and edit many files in a pair of directories. I have two scripts that work great when run separately, but I'm having problems combining the two. The goal is to gunzip the files found in the first script and pipe them to the bash/sed script and... (9 Replies)
Discussion started by: timj123
9 Replies
SHELLTEST(1)							   version 1.2.1						      SHELLTEST(1)

NAME
shelltestrunner - test command-line programs or arbitrary shell commands SYNOPSIS
shelltest [options] {testfiles|testdirs} DESCRIPTION
shelltestrunner tests command-line programs (or arbitrary shell commands). It reads simple declarative tests specifying a command, some input, and the expected output, and can run them run in parallel, selectively, with a timeout, in color, and/or with differences high- lighted. OPTIONS
-a, --all Show all failure output, even if large -c, --color Show colored output if your terminal supports it -d, --diff Show failures in diff format -p, --precise Show failure output precisely (good for whitespace) -x STR, --exclude=STR Exclude test files whose path contains STR --execdir Run tests from within the test file's directory. Test commands normally run within your current directory; --execdir makes them run within the directory where they are defined, instead. --extension=EXT Filename suffix of test files (default: .test) -w, --with=EXECUTABLE Replace the first word of (unindented) test commands. This option replaces the first word of all test commands with something else, which can be useful for testing alternate versions of a program. Commands which have been indented by one or more spaces will not be affected by this option. --debug Show debug info, for troubleshooting --debug-parse Show test file parsing info and stop --help-format Display test format help -?, --help Display help message -V, --version Print version information -- TFOPTIONS Set extra test-framework options like -j/--threads, -t/--select-tests, -o/--timeout, --hide-successes. Use -- --help for a list. Avoid spaces. DEFINING TESTS
Test files, typically named tests/*.test, contain one or more tests consisting of: o a one-line command o optional standard input (<<<), standard output (>>>) and/or standard error output (>>>2) specifications o an exit status (>>>=) specification Test format: # optional comment the command to test <<< zero or more lines of standard input >>> zero or more lines of expected standard output (or /REGEXP/ added to the previous line) >>>2 zero or more lines of expected standard error output (or /REGEXP/ added to the previous line) >>>= EXITCODE (or /REGEXP/) o A /REGEXP/ pattern may be used instead of explicit data. In this case a match anywhere in the output allows the test to pass. The regu- lar expression syntax is regex-tdfa (http://hackage.haskell.org/package/regex-tdfa)'s. o EXITCODE is a numeric exit status (http://en.wikipedia.org/wiki/Exit_status), eg 0 for a successful exit. o You can put ! before a /REGEXP/ or EXITCODE to negate the match. o Comment lines beginning with # may be used between tests. EXAMPLES
Here's example.test, a file containing two simple tests: # 1. let's test that echo runs. Numbering your tests can be helpful. echo >>>= 0 # 2. and now the cat command. On windows, this one should fail. cat <<< foo >>> foo >>>= 0 Run it with shelltest: $ shelltest example.test :t.test:1: [OK] :t.test:2: [OK] Test Cases Total Passed 2 2 Failed 0 0 Total 2 2 AUTHORS
Simon Michael. shelltestrunner March 18 2012 SHELLTEST(1)
All times are GMT -4. The time now is 09:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy