10-29-2008
try awk instead of a cut
in place of the cut, try awk
awk '{print $9}'
this will print the 9th field, which was separated by space and/or tab characters.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all!
Here is my problem :
$ more file
yougli:passwd:123456:3265:Yepa Yepo:/home/yougli:/bin/ksh
As you can see, in the field "information", there are two spaces between "Yepa" and "yepo".
My problem is :
$ PARAM='more file | cut -d":" -f5'
$ echo $PARAM
Yepa Yepo
Now i only... (2 Replies)
Discussion started by: tomapam
2 Replies
2. Shell Programming and Scripting
I am trying to take one part of my text from file and save it to variable $x
I tryed this...
x=`cut -c 6-9 $fajl`
my file looks like this
fajl:
21890001277 89386911 23638FBCDC 28EE01A1 0000 26855 124 244326
21890001277 89766911 23638FBCDC 28E021A1 0000 26557 134 684326
21890001277... (7 Replies)
Discussion started by: amon
7 Replies
3. Shell Programming and Scripting
Hi,
I have a shell script that reads a parameter file to set variables. I have an issue when the parameter I try to read contains whitespace.
e.g
File Contents
Code
The result is SUBJECT is set to
and I want subject set to
I've tried different variations but nothing seems to... (19 Replies)
Discussion started by: Greygor
19 Replies
4. Shell Programming and Scripting
I need to read in a file and output it without the comments or newlines.
The problem is that is not outputting it properly.
STUDENTSDETAILFILE="../data/studentDetails.txt"
for getlines in `sed '/#/d' $STUDENTSDETAILFILE`
do
STUDENTID=`echo $getlines | cut -d: -f1`
... (1 Reply)
Discussion started by: nerdbot
1 Replies
5. Shell Programming and Scripting
Hi
I have a strange problem when using cut command
when i am using the below command, it is working fine,I am getting the data in new file xyz.dat
cut -c 1-75 abc.dat > xyz.dat
when i am using the below command, I am getting the data in new file abc.dat , but empty file
cut -c 1-75... (4 Replies)
Discussion started by: vaas
4 Replies
6. Shell Programming and Scripting
Hi!
I get a md5 hash of a file with this command:
openssl md5 /Users/me/MyLogo.png | cut -f 2 -d ' '
"cut" because I just want the hash. But there is a problem -> that doen't work with a path with spaces:
openssl md5 /Users/me/MyLogo 2.png | cut -f 2 -d ' '
The result is "2.png)=" ...... (1 Reply)
Discussion started by: Dirk Einecke
1 Replies
7. Shell Programming and Scripting
Hi, I am facing issue with cut and wc. here is the sample.
the data in file -
tail -1 05_19_BT_TBL_LOAD_20120524064242.bad|cut -c9-58
WatsSaver - AGGREGATED PLAN1581 CALLS FOR 2872.6
tail -1 05_19_BT_TBL_LOAD_20120524064242.bad|cut -c9-58|wc -c
51
tail -1... (12 Replies)
Discussion started by: donadarsh
12 Replies
8. Shell Programming and Scripting
Hi,
I have a file like this -->
Consider z as space
#cat filename
ABC
<!--Nzzzzz-->
<!--RESUMO-->
EFG
XYZ
<!--Nzzzzz-->
<!--RESUMO-->
I need to cut the <!--RESUMO--> part and paste it to the previous line so that the file will look like this-->
ABC
<!--Nzzzzz--><!--RESUMO-->... (4 Replies)
Discussion started by: samsonata
4 Replies
9. UNIX for Dummies Questions & Answers
Hi,
My source file happens to be src.src with following contents:
1,liv 52,syrup,twice a day,children
When I do a :
for ii in `cat src.src`
do
echo $ii
medicine_name=`echo $ii | cut -f -d2","`
echo $medicine_name
done
I get output of
echo $medicine_name
as :
an the output of... (2 Replies)
Discussion started by: dipanchandra
2 Replies
10. Shell Programming and Scripting
Hi Friend ,
i have one file say xyz.lst and it has content like
dn: cn=m.hariharan,cn=employee,cn=delhi circle,cn=users,dc=industowers,dc=c
dn: cn=ajay.jain,cn=employee,cn=gujarat circle,cn=users,dc=industowers,dc=com
dn: cn=ajitkumar.thakor,cn=employee,cn=gujarat... (4 Replies)
Discussion started by: harish anand
4 Replies
LEARN ABOUT DEBIAN
dbs-edit-patch
DBS-EDIT-PATCH(1) Debian Build System DBS-EDIT-PATCH(1)
NAME
dbs-edit-patch - Edit a DBS patch
SYNOPSIS
dbs-edit-patch [options] patch
dbs-edit-patch -h|--help
DESCRIPTION
dbs-edit-patch is script to generate or modify patches for Debian source-packages in DBS format.
WARNING
dbs is deprecated, please switch to the `3.0 (quilt)' Debian source package format instead. See http://wiki.debian.org/Projects/Deb-
Src3.0#FAQ for a short guide how to do it.
OPTIONS
-h, --help
Show summary of options.
-t dir, --tmpdir=dir
Directory for the temporary files, default is /tmp or if set $TMP.
-s dir, --sourcedir=dir
Top level directory of the debian-package source-tree, default is the present working directory.
-P dir, --sourcepatchdir=dir
Directory containing upstream patches.
-T dir, --sourcetardir=dir
Directory containing the upstream tarball.
-p level, --strip=level
Striplevel -p of patch (Option -p of diff(1)), accepted values are 0 and 1, default is 0.
ENVIRONMENT VARIABLES
TMP Sets the directory for the temporary files, can be overridden with -t dir.
debian/vars
dbs-edit-patch will automatically use variables defined in the optional debian/vars file.
When a file debian/vars.in exists and debian/vars either does not exist or is older than any of the following files: debian/vars.in,
debian/changelog, debian/rules or debian/control, then dbs-edit-patch will try updating the vars file by running the following command
make -f debian/rules -W debian/vars.in debian/vars
EXAMPLES
Edit the 021_debian patch of Heimdal:
~/heimdal-0.3d> dbs-edit-patch -t/tmp 021_debian
Extracting source heimdal-0.3d.tar.gz ... successful.
Applying patch 001_replay ... successful.
etc.
Copying heimdal-0.3d to heimdal-0.3d-old ... successful.
Applying patch 021_debian ... successful.
Edit files under /tmp/021_debian/heimdal-0.3d as required, then put a short description into /tmp/021_debian/patch-description if desired,
and finally execute /tmp/021_debian/dbs-update-patch to save the results.
Technical note: dbs-edit-patch extracts all patches before 021_debian into /tmp/021_debian/heimdal-0.3d, copies the result to
/tmp/021_debian/heimdal-0.3d-old, and applies the last patch 021_debian (if it exists). Also, it creates a shell script which will create
the diff between the old and new directories:
~/heimdal-0.3d> ls -la /tmp/021_debian
total 12
-rwxr-xr-x 1 bam users 112 Jan 31 13:31 dbs-update-patch*
-rw-r--r-- 1 bam users 0 Jan 31 13:31 patch-description
drwxr-xr-x 14 bam users 4096 Jan 31 13:31 heimdal-0.3d/
drwxr-xr-x 14 bam users 4096 Jan 31 13:31 heimdal-0.3d-old/
drwxr-xr-x 5 bam users 4096 Jan 31 13:31 .stampdir/
~/heimdal-0.3d> cat /tmp/021_debian/dbs-update-patch
#!/bin/sh -e
cd "/tmp/021_debian"
HOOK_DIR="/usr/src/heimdal/debian/dbs-hooks"
test -d "$HOOK_DIR" && run-parts "$HOOK_DIR" --arg update-patch-prediff
find -name "*.bak" -print0 | xargs -0 --no-run-if-empty rm
find -name "*~" -print0 | xargs -0 --no-run-if-empty rm
: > new_patch
test ! -e patch-description || cp patch-description new_patch
diff -ruN heimdal-0.3d-old heimdal-0.3d >> new_patch || test $? -eq 1
mv new_patch /usr/src/heimdal/debian/patches/021_debian
test -d "$HOOK_DIR" && run-parts "$HOOK_DIR" --arg update-patch-postdiff
SEE ALSO
diff(1), dbs(7), /usr/share/doc/dbs/
AUTHOR
DBS was written by Adam Heath, modified by Ben Collins, modified and packaged for Debian by Brian May. This manpage was generated by
Andreas Metzler and modified by Robert Luberda.
Debian February 15th, 2011 DBS-EDIT-PATCH(1)