Sponsored Content
Full Discussion: CUT Command
Top Forums UNIX for Dummies Questions & Answers CUT Command Post 302069015 by shoeb_syed on Wednesday 22nd of March 2006 06:59:56 AM
Old 03-22-2006
CUT Command

Quote:
Originally Posted by gauravgoel
hi,
yes you can do it.
are you getting any problem

Gaurav
Yes Gaurav,

It is just assigning the value to 1st variable only.

Rest are ignored.

My code is as below, Forgive me if I am making a silly mistake as I am very new to UNIX scripting and just practicing some commands:

Code:
awk {'print $1'} filename | while read line
do 
val=$1
tmp=`cut -c 1-4 $val`
tmp1=`cut -c 5-12 $val`
tmp2=`cut -c 13-18 $val`
echo $tmp $tmp1 $tmp2 >> tmpfile
done

In the tmpfile it is just giving 1st four characters from the variable.

Can you suggest what is wrong in it.

Thanks in advance.

Best Regards

Shoeb

Last edited by shoeb_syed; 03-22-2006 at 08:01 AM.. Reason: typo error
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cut command

i have the following line set line=abc d efg h^ijklmno and then i say: echo $line | cut -d^ -f1 i want to receive this: abc d efg h instead i receive this: abc d efg h how can i ignore blanks in the cut command? (4 Replies)
Discussion started by: tolkki
4 Replies

2. UNIX for Dummies Questions & Answers

Cut Command help

Hi , I am new to Unix.I have a shell script whenere I wnat to find if a particular server is running and kill all the instances of it (running on different ports) script filename to start the srever is say abcd If i do ps -eaf | grep abc I get all the instances of srever running .In the... (1 Reply)
Discussion started by: shradham
1 Replies

3. AIX

Use of Cut Command

Hi All, Can anyone tell me how to use cut command?I have tried but its not working...Please find the details below : $ cat file1 SlNo. E_ID E_Name Age Dept 1 123 A 20 Electrical 2 124 B 20 Electronics 3 125 C 24 Computer 4 126 D 23 Mechanical ... (3 Replies)
Discussion started by: Puja Sharma
3 Replies

4. Shell Programming and Scripting

cut command help

n2=user1 pts/3 2010-06-29 01 Now i want to split this string with space(' ') character. After splitting output would be: use1 pts/3 2010-06-29 01 I did: nn=${n2} | cut -d ' ' -f2 echo ${nn} It prints nothing. I want the output: pts/3 (2 Replies)
Discussion started by: cola
2 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. 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

7. AIX

Need help on cut command

HI, i have data in one variable like out=/usr/sbin/filename and i want output like only out=filename how to do (5 Replies)
Discussion started by: sumanthupar
5 Replies

8. Shell Programming and Scripting

Cut command

Hi All, I am a beginner learning shell script, Would it be possible to use -c and -f in cut command together ? Example : /opt/oracle/work/Antony/Shell_Script> cat shortlist 2233|a.k. shukula |g.m. |sales2 |12/12/52 |6000 1006|chanchal singhvi ... (3 Replies)
Discussion started by: Antony Ankrose
3 Replies

9. UNIX for Beginners Questions & Answers

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... (9 Replies)
Discussion started by: scrutinizerix
9 Replies
sccs-val(1)							   User Commands						       sccs-val(1)

NAME
sccs-val, val - validate an SCCS file SYNOPSIS
/usr/ccs/bin/val - /usr/ccs/bin/val [-s] [-m name] [-rsid] [-y type] s.filename... DESCRIPTION
The val utility determines if the specified s.files meet the characteristics specified by the indicated arguments. val can process up to 50 files on a single command line. val has a special argument, `-', which reads the standard input until the end-of-file condition is detected. Each line read is indepen- dently processed as if it were a command line argument list. val generates diagnostic messages on the standard output for each command line and file processed and also returns a single 8-bit code upon exit as described below. The 8-bit code returned by val is a disjunction of the possible errors, that is, it can be interpreted as a bit string where (moving from left to right) the bits set are interpreted as follows: bit 0 = missing file argument bit 1 = unknown or duplicate option bit 2 = corrupted s.file bit 3 = can not open file or file not in s.file format bit 4 = the SCCS delta ID (SID) is invalid or ambiguous bit 5 = the SID does not exist bit 6 = mismatch between %Y% and -y argument bit 7 = mismatch between %M% and -m argument val can process two or more files on a given command line, and in turn can process multiple command lines (when reading the standard input). In these cases, an aggregate code is returned which is the logical OR of the codes generated for each command line and file pro- cessed. OPTIONS
The following options are supported: -s Silent. Suppresses the normal error or warning messages. -m name Compares name with the %M% ID keyword in the s.file. -rsid Checks to see if the indicated SID is ambiguous, invalid, or absent from the s.file. -y type Compares type with the %Y% ID keyword. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of val: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsprot | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
sccs(1), sccs-admin(1), sccs-delta(1), sccs-get(1), sccs-help(1), what(1), sccsfile(4), attributes(5), environ(5), standards(5) DIAGNOSTICS
Use the SCCS help command for explanations (see sccs-help(1)). SunOS 5.10 30 Sep 2002 sccs-val(1)
All times are GMT -4. The time now is 06:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy