Sponsored Content
Full Discussion: String removal from file
Top Forums Shell Programming and Scripting String removal from file Post 302882989 by jaydeep_sadaria on Friday 10th of January 2014 09:29:56 AM
Old 01-10-2014
String removal from file

Dear all

From below mention input file I needed op file as show below. I am using below code but not worked.


I/p file
Code:
BSCBCH1 EXAL-1-4     WO*     SMPS MAINS FAIL
BSCBCH1 EXAL-1-5     WO*     SMPS RECTIFIER FAIL 
BSCBCH1 EXAL-1-6     WO*    SMPS MAJOR ALARM 
BSCBCH2 EXAL-1-10    WO*    AC2 UNIT FAIL 
BSCBCH2 EXAL-1-14    WO*    AC1 UNIT FAIL

o/p file:
Code:
BSCBCH1  SMPS MAINS FAIL
BSCBCH1  SMPS RECTIFIER FAIL 
BSCBCH1  SMPS MAJOR ALARM 
BSCBCH2  AC2 UNIT FAIL 
BSCBCH2  AC1 UNIT FAIL

below code not worked:

Code:
awk '{a=$1} /WO/ {b=$4} {print a b}' finename.txt

Thanks in advance.

Regards
Jaydeep
 

10 More Discussions You Might Find Interesting

1. Solaris

UNIX File removal without conformation

I need to remove permanently some 3 GB of temp folder which contains Log file, simulation files from my disk. if i use "rm - rf <filename>" command it asks about conformation for accessing each folder and for removing every file and giving yes to every message in terminal window is very... (2 Replies)
Discussion started by: rajharvijay
2 Replies

2. Shell Programming and Scripting

Removal of Duplicate Entries from the file

I have a file which consists of 1000 entries. Out of 1000 entries i have 500 Duplicate Entires. I want to remove the first Duplicate Entry (i,e entire Line) in the File. The example of the File is shown below: 8244100010143276|MARISOL CARO||MORALES|HSD768|CARR 430 KM 1.7 ... (1 Reply)
Discussion started by: ravi_rn
1 Replies

3. UNIX for Dummies Questions & Answers

selective removal of blank spaces in string

Hi, I'm a newbie to shell scripting and I have the following problem: I need all spaces between two letters or a letter and a number exchanged for an underscore, but all spaces between a letter and other characters need to remain. Searching forums didn't help... One example for clarity: ... (3 Replies)
Discussion started by: Cpt_Cell
3 Replies

4. Shell Programming and Scripting

Removal of file extension question

All, I know that this will remove a file extension from a file name, but reading on the documentation on how it works confuses me. ${filename%.*}Can anyone explain what exactly is going on here? Filename is the pattern and % says to cut anything that starts with .? Also, can I run this... (4 Replies)
Discussion started by: markdjones82
4 Replies

5. Shell Programming and Scripting

Help with removal of blank spaces in a file

Hello.. I have a text file. I want to remove all the blank spaces(except tab) from the file.. I tried using sed command as shown below sed 's/ //g' file1 But the problem with the above command is that it also eliminates 'tab' which is between the columns.. For example if the contents... (7 Replies)
Discussion started by: abk07
7 Replies

6. Shell Programming and Scripting

Help with removal of numericals in a file

I have a file from which I want to eliminate the numerical values.. The contents of the file are as shown below.. 1 a1,b,2 1,b,c 2 a2,4,b a,b,2 From the above file I want eliminate only the numberical values(except the line numbers which are at the beginning).. The file... (12 Replies)
Discussion started by: abk07
12 Replies

7. Programming

Fast string removal from large text collection

Hi All, I don't want any codes for this problem. Just suggestions: I have a huge collection of text files (around 300,000) which look like this: 1.fil orange apple dskjdsk computer skjks The entire text collection (referenced above) has about 1 billion words. I have created... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

8. Solaris

Removal of zip file permanently

Hi Everyone, I see some peculier thing happening on my server. I have one zipped file created long back as a normal user and trying to remove it now. When i tried to remove as that particular user, i was not able to do that. So i logged in as a root user and removed that successfully. But it... (8 Replies)
Discussion started by: Sricharan21
8 Replies

9. UNIX for Dummies Questions & Answers

awk string removal

Hi, I am trying to remove a string ".var" using the below command but it's not working as expected, when I execute this in the command prompt using the echo it's working fine , please let me know where I am doing it wrong. UYRD=$FILE_$timestamp.csv | awk '{gsub(".var", "");print}' # this is... (6 Replies)
Discussion started by: shruthidwh
6 Replies

10. Shell Programming and Scripting

Removing string from CSV file by provide removal string from other file

What I need is to remove the text from Location_file.txt from each line matching all entries from Remove_location.txt Location_file.txt FlowPrePaid, h3nmg1cm2,Jamaica_MTAImageFileFlowPrePaid,h0nmg1cm1, Flow_BeatTest,FlowRockTest FlowNewTest,FlowNewTest,h0nmg1cm1 PartiallySubscribed,... (3 Replies)
Discussion started by: ketanraut
3 Replies
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)
All times are GMT -4. The time now is 04:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy