Sponsored Content
Full Discussion: Cut position as a variable
Top Forums Shell Programming and Scripting Cut position as a variable Post 302198762 by Raynon on Friday 23rd of May 2008 10:57:07 PM
Old 05-23-2008
Cut position as a variable

Hi All,

I wish to cut an input by using the below command but i would want to have the cut position as a variable.
For eg, the position number is 11 now and i wish that this number is being assigned to a variable before putting into the cut function.
Can this be done ?
Can any expert help? I am using csh by the way.

Code:
cut -c11-

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cut output to same byte position

Hi folks I have a file with thousands of lines with fixed length fields: sample (assume x is a blank space) 111333xx444TTTLKOPxxxxxxxxx I need to make a copy of this file but with only some of the field positions, for example I'd like to copy the sample to the follwing: so I'd like to... (13 Replies)
Discussion started by: HealthyGuy
13 Replies

2. Shell Programming and Scripting

Cut multiple data based on character position

How to extract multiple data based on character position. I need to fetch from 7-9 and 22-26 and there is no delimiter for 22-26 since it is part of the column. The file may have more than 1000 character long.I managed to pull any one but not both for example test data 12345 zxc vbnmlk... (1 Reply)
Discussion started by: zooby
1 Replies

3. Shell Programming and Scripting

Get character position within variable

Hi all let's say i have a file named 1234_v2_abcd i need to find the position of the character located after _v, in above case this would be character number 2 the count of the characters before _v can change, but i always have a number after _v can anybody help :) (4 Replies)
Discussion started by: gigagigosu
4 Replies

4. Shell Programming and Scripting

Finding position of space in a variable

HI All, am trying to find the position of space in a variable, it is working for other characters other than space ulab="ulab1|ulab2" find_pos=`expr index $ulab '|'` echo $find_pos above code worked fine but below one says syntax error ulab="ulab ulab2" find_pos=`expr index $ulab ' '`... (2 Replies)
Discussion started by: ulab
2 Replies

5. Shell Programming and Scripting

Change text at a variable position

Hi there script guru's I have an input file /tmp/in.txt of which the data is seperated by a : (example of the data) test1:zz:2000:2000:zzz te:a:2000:3333:bbb testabs:x:2004:3000:cccc I would like to run a scrip (bash) changing the data after the second ":" example Test for the value of... (3 Replies)
Discussion started by: KobusE
3 Replies

6. Shell Programming and Scripting

How to cut line from certain position?

Hi Gurus, I want to cut my file from 27th charactor to the end of line. can anybody give some unix command to do this. Thanks in advance (3 Replies)
Discussion started by: ken6503
3 Replies

7. UNIX for Dummies Questions & Answers

Help with awk, where line length and field position are variable

I have several questions about using awk. I'm hoping someone could lend me a hand. (I'm also hoping that my questions make sense.) I have a file that contains pipe separated data. Each line has similar data but the number of fields and the field position on each line is variable. ... (3 Replies)
Discussion started by: Cheese64
3 Replies

8. UNIX for Beginners Questions & Answers

Cut two individual position and summ

Hi All, I am having a huge file file. I need to cut the below column and do the below calculation I did the below command and able to do on full databased no on the individual based any help on doing each row by row cut -c 52-56 myfile | awk '{total = total + $1}END{print total}'... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

9. Shell Programming and Scripting

Cut command with dynamic passing of delimiter and position values

Hi All, We have a requirement of picking nth position value by using cut command. value would be delimited by any symbols. We have to pass delimited value and postition to get the value in a string. ex. echo "A,B,C,D,E" |cut -d "," -f3 echo "A|B|C|D|E"|cut -d "|" -f2 Kindly frame the... (5 Replies)
Discussion started by: KK230689
5 Replies

10. Programming

Python variable at different position

I have a file which records banking transactions say like below. user1 has deposited 10,000$ in his account user2 has deposited 11,000$ in his account user1 has withdraw today 5000$ from his account. Lets say i read this file and convert each line as a list. username= word action=... (1 Reply)
Discussion started by: sahil_shine
1 Replies
HOZ(1)								   User Commands							    HOZ(1)

NAME
hoz - file splitter that uses the hacha file format SYNOPSIS
hoz [-pvf] [-c size[K|M]] [-o outpath] inputfname ghoz DESCRIPTION
HOZ is a file splitter, which uses the same file format as the popular 'Hacha' program. OPTIONS
-c --cut cut (file->pieces) -p --paste paste (pieces->file) -v --verbose verbose output -f --force force overwrite of file when pasting -o --outpath specify an output directory -h --help print this help, then exit --version print hoz program version number, then exit USAGE
There are two basic operations: cut and paste. Cut will 'split' a file in pieces. The size of each piece is passed as an option. Each piece will have a numeric extension, starting with 0. So for instance if you 'cut' a file called 'foo.iso', the pieces will be named 'foo.iso.0', 'foo.iso.1' and so on. Paste will 'merge' these pieces and generate and exact copy of the original file. ghoz is the graphical version of hoz, which uses a GTK GUI interface. SEE ALSO
You can find more information at http://hoz.sourceforge.net/ hoz 1.65 August 2008 HOZ(1)
All times are GMT -4. The time now is 05:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy