10-04-2019
I'm a bit confused what you are trying to do with more Expected.del | cut -d, -f1 >> Original.out You might really want just cut -d, -f1 Expected.del >> Original.out
The more command is not the right tool. At a push, maybe cat that that is also wasteful (search for uuoc in your favourite search engine). It is far better to just use the processing command you choose to read the file rather than push it in through a pipe. It will slow down your processing if you have large files and worse if you repeat the process several times.
Just a thought,
Robin
10 More Discussions You Might Find Interesting
1. BSD
Hi,
I am running OpenBSD 3.7, my first attempt with this OS. I noticed that both /bin/sh and /bin/ksh are both really the pdksh. Yet each has its own manpage. I was wondering what are the differences b/w the two programs on OpenBSD. I.e., has the team configured pdksh to function one way if... (3 Replies)
Discussion started by: hadarot
3 Replies
2. Shell Programming and Scripting
Hi
I need to create multiple text files from onc text file on AIX. The data of text files is as below:
**********************************************
**********************************************
DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009
Copyright (c) 1982,... (11 Replies)
Discussion started by: lodhi1978
11 Replies
3. UNIX for Dummies Questions & Answers
Hi
i have gone through some sdiff command it shows the differences side by side and its really awesome
file 1:
this tool is for
checking the differ
merging with flower pots documentation
file 2:
this t ool is for
checking the differ
mergin g with flower pots documentation
... (27 Replies)
Discussion started by: rakeshkumar
27 Replies
4. AIX
Hi,
I'm trying to create a script to catch a process which is consuming high CPU which I have pretty much done but it's just finding the correct place to pull the current CPU for that process.
When viewed in Topas it's consuming 99.*% cpu
But if I try using
ps avg or ps -eo pcpu
... (5 Replies)
Discussion started by: elmesy
5 Replies
5. Shell Programming and Scripting
Hello, I have a pretty simple question, but I am new to Python and am trying to write a simple program. Put simply, I want to take a text file that looks like this:
11111 22222
33333 44444
55555 66666
77777 88888
and produce two lists, one containing the contents of the left column, one the... (0 Replies)
Discussion started by: Tyler_92
0 Replies
6. UNIX for Advanced & Expert Users
I have started a new job which requires AIX admin skills, which I have, and RHEL skills. Does anyone have a cheat sheet that if I know how to solve the problem in AIX how would I do that in RHEL? I was an IBM pre-sales technical trying to keep sales guys honest - not possible. Any other links to... (5 Replies)
Discussion started by: SpenceSnyder
5 Replies
7. Shell Programming and Scripting
I have a list of files that should contain the following
Im trying to find the items of interest that are missing from each file and create a csv.
cat *.txt | while read file
do
grep 3500 file | tr '\012' ','
done
My problem is this possible output
one.txt ... (2 Replies)
Discussion started by: popeye
2 Replies
8. UNIX for Advanced & Expert Users
Why does dot sourcing of ksh functions behave so differently between AIX, Solaris, and Linux? How can I make Linux behave the way I want in the test I show below?
I have a library of interdependent functions I have developed and use in ksh in AIX. They also run in Solaris. Now I am migrating... (9 Replies)
Discussion started by: charles_n_may
9 Replies
9. Shell Programming and Scripting
Not really sure how to accomplish this. If I have two lists with matching columns. Second column is different. I would like to show the differences plus/minus.
list1
device1 5
decive2 10
decive3 10
device4 10
device5 10
device6 20
list2
device1 10
... (1 Reply)
Discussion started by: mrlayance
1 Replies
10. Shell Programming and Scripting
Greetings all, I have two output lists from a log that I am working with. Below are the examples. except, the lists are in the thousands.
list1.out
FEA1234
FEA4343
FEA3453
FEA3413
FEA34A3
FEA3433
....
list2.out
FEA1235 (3 Replies)
Discussion started by: jeffs42885
3 Replies
cut(1) General Commands Manual cut(1)
Name
cut - cut out selected fields of each line of a file
Syntax
cut -clist [file1 file2...]
cut -flist [-dchar] [-s] [file1 file2...]
Description
Use the command to cut out columns from a table or fields from each line of a file. The fields as specified by list can be fixed length,
that is, character positions as on a punched card (-c option), or the length can vary from line to line and be marked with a field delim-
iter character like tab (-f option). The command can be used as a filter. If no files are given, the standard input is used.
Use to make horizontal ``cuts'' (by context) through a file, or to put files together in columns. To reorder columns in a table, use and
Options
list Specifies ranges that must be a comma-separated list of integer field numbers in increasing order. With optional - indicates
ranges as in the -o option of nroff/troff for page ranges; for example, 1,4,7; 1-3,8; -5,10 (short for 1-5,10); or 3- (short
for third through last field).
-clist Specifies character positions to be cut out. For example, -c1-72 would pass the first 72 characters of each line.
-flist Specifies the fields to be cut out. For example, -f1,7 copies the first and seventh field only. Lines with no field delim-
iters are passed through intact (useful for table subheadings), unless -s is specified.
-dchar Uses the specified character as the field delimiter. Default is tab. Space or other characters with special meaning to the
shell must be quoted. The -d option is used only in combination with the -f option, according to XPG3 and SVID2/SVID3.
-s Suppresses lines with no delimiter characters. Unless specified, lines with no delimiters are passed through untouched.
Either the -c or -f option must be specified.
Examples
Mapping of user IDs to names:
cut -d: -f1,5 /etc/passwd
To set name to the current login name for the csh shell:
set name=`who am i | cut -f1 -d" "`
To set name to the current login name for the sh, sh5, and ksh shells:
name=`who am i | cut -f1 -d" "`
Diagnostics
"line too long" A line can have no more than 511 characters or fields.
"bad list for c/f option"
Missing -c or -f option or incorrectly specified list. No error occurs if a line has fewer fields than the list calls
for.
"no fields" The list is empty.
See Also
grep(1), paste(1)
cut(1)