Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Cut command: can't make it cut fields Post 302971678 by scrutinizerix on Saturday 23rd of April 2016 07:50:52 PM
Old 04-23-2016
Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of cut command so to have columns 1,3,4,9 cut (e.g. "left").

However when I'm trying to execute the command

Code:
cut -f 1,3,4,9 My_dir.tsv

nothing happens. I guess it's because the file isn't formatted properly with regard to implementing tabbed spaces. I imagined that automatic formatting, with the deployment of columns I see in output, emerging along with the result of ls is a .tsv file by default but I was wrong.

What should I do to make it work as intended? How do I make a real .tsv file of ls output?

My OS is OS X (Lion).
Cut command: can't make it cut fields-tsvpng
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to cut fields

I want to cut two coloums simulatiously and paste in some other file for ex: cut d ' ' -f3 -f4 xxx | paste yyy - > zzz; from the above i want to cut two fileds 3 and 4 and paste as last coloums of single file (zzz). how to solve this regards rajan (1 Reply)
Discussion started by: rajan_ka1
1 Replies

2. Shell Programming and Scripting

Cut Last 3 Fields

I have a text: dsj khfksjdh <time> EST 2006 ab cgnr jkkjt <time> EST 2006 gfhdgjghg <time> EST 2006 fkdjh kjhsekjrh kdjhfkh jhdfkhfdkjh kjdf <time> EST 2006 In the above file i need to extract time from every line... which is always the third from the last... Pls help! Cheers, Bouren (4 Replies)
Discussion started by: bourne
4 Replies

3. Shell Programming and Scripting

cut: get either one or two fields

Hello, I would like to extract one or two fields of a line. At the moment, I am extracting the first field of a line: command | cut -f 1 -d '.' > file The line can have two or three fields delimited with a dot. if three fields, I want to be able to get the first two ie if line =... (3 Replies)
Discussion started by: maxvirrozeito
3 Replies

4. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

5. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

6. Shell Programming and Scripting

How to make the cut command read a column after logical statements are meet?

Hi, I want to write a code that will cut everything that is under a couple of columns in a text file but so far I am not even close to achieve something like that. Basically, I want to cut all the information from the columns and transfer the column information to a spread sheet. I have... (1 Reply)
Discussion started by: pericopericone
1 Replies

7. UNIX for Dummies Questions & Answers

Cut pid from ps using cut command

hay i am trying to get JUST the PID from the ps command. my command line is: ps -ef | grep "mintty" | cut -d' ' -f2 but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that. i know i can use awk or cut... (8 Replies)
Discussion started by: ran ber
8 Replies

8. Shell Programming and Scripting

Need a separator string between fields in cut -c command

Hi All, I'm trying to view data using cut command for a fixed length file using the below command: cut -c 1-3,4-5 FALCON_PIS_00000000.dat I want to mention a separator say | (pipe) in between 1-3 and 4-5. Please let me know how to achieve this. Thanks in Advance, (3 Replies)
Discussion started by: HemaV
3 Replies

9. Shell Programming and Scripting

How To Count Fields For Cut?

I am new to cut and I want to use the field option with a space delimiter on an Apache log file. For example, if I wanted to find the 200 HTTP code using cut in this manner on the file below cat access_abc.log | cut -d' ' -f7 | grep "200" 157.55.39.183 - - "GET /content/696-news041305... (4 Replies)
Discussion started by: sharingsunshine
4 Replies
CBCODEC(1)						      Quick Database Manager							CBCODEC(1)

NAME
cbcodec - popular encoders and decoders SYNOPSIS
cbcodec url [-d] [-br] [-rs base target] [-l] [-e expr] [file] cbcodec base [-d] [-l] [-c num] [-e expr] [file] cbcodec quote [-d] [-l] [-c num] [-e expr] [file] cbcodec mime [-d] [-hd] [-bd] [-part num] [-l] [-ec code] [-qp] [-dc] [-e expr] [file] cbcodec csv [-d] [-t] [-l] [-e expr] [-html] [file] cbcodec xml [-d] [-p] [-l] [-e expr] [-tsv] [file] cbcodec zlib [-d] [-gz] [-crc] [file] cbcodec lzo [-d] [file] cbcodec bzip [-d] [file] cbcodec iconv [-ic code] [-oc code] [-ol ltype] [-cn] [-wc] [-um] [file] cbcodec date [-wf] [-rf] [-utc] [str] DESCRIPTION
This manual page documents briefly the cbcodec commands. cbcodec is a tool to use encoding and decoding features provided by Cabin. This command is used in the above format. file specifies a input file. If it is omitted, the standard input is read. OPTIONS
A summary of options is included below. For a complete description, see the file:///usr/share/doc/qdbm-doc/spex.html#cabincli. -d perform decoding (unescaping), not encoding (escaping). -br break up URL into elements. -rs resolve relative URL. -l output the tailing newline. -e expr specify input data directly. -c num limit the number of columns of the encoded data. -hd parse MIME and extract headers in TSV format. -bd parse MIME and extract the body. -part num parse MIME and extract a part. -ec code specify the input encoding, which is UTF-8 by default. -qp use quoted-printable encoding, which is Base64 by default. -dc output the encoding name instead of the result string when decoding. -t parse CSV. Convert the data into TSV. Tab and new-line in a cell are deleted. -html parse CSV. Convert the data into HTML. -p parse XML. Show tags and text sections with dividing headers. -tsv parse XML. Show the result in TSV format. Characters of tabs and new-lines are URL-encoded. -gz use GZIP format. -crc output the CRC32 checksum as hexadecimal and big endian. -ic code specify the input encoding, which is detected automatically by default. -oc code specify the output encoding, which is UTF-8 by default. -ol ltype convert line feed characters, with `unix'(LF), `dos'(CRLF), and `mac'(CR). -cn detect the input encoding and show its name. -wc count the number of characters of the input string of UTF-8. -um output mappings of UCS-2 characters and C strings of UTF-16BE and UTF-8. -wf output in W3CDTF format. -rf output in RFC 1123 format. -utc output the coordinate universal time. SEE ALSO
qdbm(3), cabin(3). AUTHOR
QDBM was written by Mikio Hirabayashi <mikio@fallabs.com>. This manual page was written by Fumitoshi UKAI <ukai@debian.or.jp>, for the Debian project (but may be used by others). Man Page 2005-05-23 CBCODEC(1)
All times are GMT -4. The time now is 01:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy