![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep - searching for a specific string | manthasirisha | Shell Programming and Scripting | 2 | 01-05-2006 09:24 AM |
| searching text files on specific columns for duplicates | Gerry405 | UNIX for Dummies Questions & Answers | 2 | 08-18-2005 10:51 AM |
| Searching for a specific phrase on Unix server | mmcaleer | UNIX for Dummies Questions & Answers | 1 | 02-07-2005 04:18 PM |
| Can't figure out how to display specific data from a line using awk. | ctcuser | Shell Programming and Scripting | 1 | 06-24-2004 02:55 PM |
| Searching for a specific string in an argumnet | dinplant | Shell Programming and Scripting | 1 | 03-11-2002 03:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Searching for data on a specific line numbers
Hi,
I have a file on windows and have some unix utilitties available on windows. This file is very large and have over 5 million record. I am not able to open this file in Window Editor. I am trying to see bad data on a specific lines. I just have line numbers that has bad data. I need to see the data at that line number. I am trying to see data let say on line 411108. I tried tail -n 411108 filename but it shows last 411108 lines instead of data on line 411108. I have tried grep and head command but it returns thousands of rows. I installed VIM on windows and tried opening the file but it only clocks for hours and does not open file. I had to kill the job. Is there a unix command that I can use to view specific data at a certain line number. I also have sed and gawk utility available on windows. Will appreciate any help.... Thanks Raj |
|
||||
|
Problem with sed
Hi all
I have a file jh that contains :- 1 2 3 4 I use have a script as follows :- #!/usr/bin/ksh F1=jh y=1 z=1 FS1=`cat $F1 | wc -l` while [ $y -le $FS1 ] do set -xv z=`expr $y + 1` st=$y"p" ed=$z"q" V1=`sed -n \'$st\;$ed\' \< $F1` echo $y y=`expr $y + 1` read a done When I execute this, I get the following result. + + expr 1 + 1 z=2 + st=1p + ed=2q + + sed -n '1p;2q' < jh sed: 0602-403 '1p;2q' is not a recognized function. V1= + echo 1 1 + + expr 1 + 1 y=2 + read a Can anyone tell me what is wrong ? Thx J |
|
||||
|
You can make as,
#!/usr/bin/ksh F1=jh y=1 z=1 FS1=`cat $F1 | wc -l` while [ $y -le $FS1 ] do set -xv z=`expr $y + 1` st=$y"p" ed=$z"q" V1=`sed -n $st\;{$ed\;} < $F1` echo $y y=`expr $y + 1` read a done |
|
||||
|
Quote:
Code:
V1=`sed -n \'$st\;$ed\' \< $F1` Code:
#!/bin/ksh
typeset -i iBegin=$1
typeset -i iEnd=$1
typeset chSedCmd=""
(( iEnd += 1 ))
chSedCmd="${iBegin}p;${iEnd}q"
sed -n $chSedCmd
exit 0
Code:
chSedCmd="\'${iBegin}p;${iEnd}q\'"
Code:
chSedCmd="'${iBegin}p;${iEnd}q'"
Hope this helps. bakunin |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|