Sponsored Content
Top Forums Shell Programming and Scripting Removing text from a line in a file Post 302164448 by H2OBoodle on Monday 4th of February 2008 11:35:18 PM
Old 02-05-2008
awk '{print $1,$2,$3,$4"]"}' inputfilename > outputfilename

Last edited by H2OBoodle; 02-05-2008 at 12:36 AM.. Reason: Removed the "," after the 4 to avoid the space being added.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing commas from text file

Dear all I have a file which looks like this xxxxxxxxxxxxxx,xxx,xxxxxxxxxx xxxxxxxxxxxxxx,xxx,xxxxxxxxxx etc basically 14 characters then a comma, three characters, then a comma then 10 characters. We are uploading this file to our mainframe and they want the commas removed, so it... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

2. Shell Programming and Scripting

Removing lines in a text file.

Here is my problem I'm hoping you guru's can help me figure out. I have a text file that contains comma delimited columns. What I'm looking to do is see if the 24th column on each row in the file contains a value (not null), and then write/append that line to a different file. I've been... (4 Replies)
Discussion started by: WABonnett
4 Replies

3. Shell Programming and Scripting

Removing a particular line from a text file

Hi, I have a file called inp.txt the contents of the file are as follows MANI123|23|41 MANI123|96|23 I want to reove the first line of this file. How can I do it. Thanks in advance (5 Replies)
Discussion started by: sendhilmani123
5 Replies

4. Shell Programming and Scripting

Sed question (Removing a line of text)

I am working with bash on HP-UX server at school. As practice for scripting, I am trying to make a pretend server admin script that adds a user to the system, deletes a user from the system, and lists all users of the pretend system. I have accomplished this with a select loop. Adding users, and... (2 Replies)
Discussion started by: masterscout1977
2 Replies

5. UNIX for Dummies Questions & Answers

Removing a string of text from a file - help please

Hey Folks, I have a file that contains data that I am working with, sometimes this file has a very long string of text that messes with an awk command in a script i am trying to build. I would like to cut this string of text out of a file and then redirect everything except that string to a new... (5 Replies)
Discussion started by: deepslp
5 Replies

6. Shell Programming and Scripting

Help with removing line from text

Hey everyone, I kinda new to shell programming and learning bits and pieces of stuff from tutorials. I got this problem, where I asked my user to enter a string, which will delete a specific line in the string, which I'm unable to do it. Text file(BookDB.txt) as shown: Three Little... (4 Replies)
Discussion started by: aLHaNz
4 Replies

7. Shell Programming and Scripting

Removing zero values from text file

Hi all, I wrote the following code to remove the value which are 0 in the input file (a columns if numbers). awk 'BEGIN { for (i=1; i<=NF; i++) if ($i) printf("%13.6e\n",$i) }' $1 >> $2 The script works if the zeros are written as 0.0000 but not as 0.000000e+00 In... (10 Replies)
Discussion started by: f_o_555
10 Replies

8. Windows & DOS: Issues & Discussions

Removing anything from text file except specific string

So, I have a text file that looks like this: 0,0: (168,168,176) #A8A8B0 srgb(168,168,176) 1,0: (168,168,176) #A8A8B0 srgb(168,168,176) 2,0: (166,166,174) #A6A6AE srgb(166,166,174) 3,0: (166,166,174) #A6A6AE srgb(166,166,174) 4,0: (168,168,176) #A8A8B0 srgb(168,168,176) 5,0:... (0 Replies)
Discussion started by: pasc
0 Replies

9. UNIX for Dummies Questions & Answers

Removing PATTERN from txt without removing lines and general text formatting

Hi Everybody! First post! Totally noobie. I'm using the terminal to read a poorly formatted book. The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this. I was hoping to use grep -v " -- "... (5 Replies)
Discussion started by: AxeHandle
5 Replies

10. UNIX for Dummies Questions & Answers

Removing \n from a text file

Hi All, I have a question regarding text substitution. I have a file that contains a lot of text. Some of the text is separated with a \n like: TEST\nTEST2\nTEST3 BLA\nBLA2\nBLA3 So there are both actual newlines and 'used to be newlines' in the text. using tr tr "\n" "," or... (5 Replies)
Discussion started by: JaapSchuurman
5 Replies
UNBLOCK_DLG(1)						      General Commands Manual						    UNBLOCK_DLG(1)

NAME
unblock_dlg - Insert linefeeds into an optional-format Digital Line Graph (DLG) file SYNOPSIS
unblock_dlg [-L] DESCRIPTION
The drawmap program processes USGS optional-format Digital Line Graph (DLG) files (along with other types of files) to produce customized maps. Drawmap is able to read these files in their native format. However, since the files usually don't contain any linefeeds, they are difficult for a human to read. Unblock_dlg filters a DLG file and inserts linefeeds for human readability. It takes input from the stan- dard input and writes to the standard output. The input data must be in uncompressed form, not in gzip-compressed form. Also, unblock_dlg does not work with SDTS DLG files. Unblock_dlg normally takes no options, but, if you use the "-L" option, the program will print out some license information and exit. Some DLG files already have embedded linefeeds. Unblock_dlg makes a feeble attempt to detect these files and abort. If the detection fails, the results are likely to be garbled, so it is wise to check the format of each file first. The drawmap program, with the "-i" option, will attempt to tell you whether a file contains linefeeds or not. The intended use of unblock_dlg is simply to let you conveniently examine the files to see what is in them. However, if you are in the mood for adventure, or if you need to repair a defective file, you can use unblock_dlg to make the file easy to edit, then you can edit the file as desired. Drawmap can still process the files after linefeeds are inserted, but will become confused if any line (including the linefeed) is more than 80 characters long. Drawmap may also become confused if you make any significant changes to the format of the file. You can use this capability to remove selected items from DLG files, when those items cause problems. You may even be able to repair faulty data. However, you need to be familiar with the content and structure of DLG files in order to do this effectively. You also need to remember that drawmap depends on DLG files having a predictable structure, and it won't properly parse files that violate this pre- dictability. Do this sort of thing only if you know what you are doing, or if you have a lot of free time on your hands. It should be noted that you can obtain a similar effect by using the command recommended by the USGS: dd if=inputfilename of=outputfilename ibs=8000 cbs=80 conv=unblock I prefer the unblock_dlg command because it simply replaces the last byte of each record with a linefeed. This lets me easily tell how long the original records were. The effect of unblock_dlg or dd can be undone by typing: dd if=inputfilename of=outputfilename ibs=8000 cbs=80 conv=block You may come across files that have a linefeed in the 81st byte. Drawmap doesn't like these, both because it can't tell (within the space of the first 80-byte record) whether the file contains linefeeds or not, and because the records exceed the maximum record length of 80 bytes. You may be able to repair such files by blocking them with the above dd command. SEE ALSO
unblock_dem(1), drawmap(1) Jul 24, 2001 UNBLOCK_DLG(1)
All times are GMT -4. The time now is 04:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy