Sponsored Content
Top Forums Shell Programming and Scripting Modify sections of the line in a file Post 302339187 by ryandegreat25 on Thursday 30th of July 2009 03:31:54 AM
Old 07-30-2009
Quote:
Originally Posted by ciba
Hi
I need to modify entire file starting from the 3 line. file looks like this
filename : exp

first line
second
1,"wes","est","ws"
1,"was","qwe","qwa"

also i have to replace the third content from 3 line by a counter . so the output should look like this:

first line
second
1,"wes","1","ws"
1,"was","2","qwa"

here 1, 2 is a type of incrementing counter ...

please help Smilie
please create new thread
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to modify a line in a file

Hello I have an input that looks like this: d:/bla1/bla2/bla3/bla1.txt d:/bla1/bla2/bla4/bla2.txt d:/bla1/bla2/bla5/bla1.txt d:/bla1/bla2/bla6/bla2.txt d:/bla1/bla2/bla7/bla1.txt and i need the output to looks like this: d:/bla1/bla2/bla3/bla1_bla3.txt... (5 Replies)
Discussion started by: RoadKill
5 Replies

2. Shell Programming and Scripting

How to modify the last line in the file.

Hi, I have data file which has header, data and trailer. The problem is that always the trailer is padded with the last line data. i want to split the trailer and bring it to next line i.e end of line. But i dont have any specific string to identify the trailer. Only way is that all data... (3 Replies)
Discussion started by: senthil_is
3 Replies

3. Shell Programming and Scripting

Modify Specific Line of a Text File

Given a text file, how do you add a line of text after a specific line number? I believe I would want to use "sed" but I am unsure of the syntax. Thank you. Mike (5 Replies)
Discussion started by: msb65
5 Replies

4. Shell Programming and Scripting

Need help to modify perl script: Text file with line and more than 1 space

Dear Friends, I am beginner in Perl and trying to find the problem in a script. Kindly help me to modify the script. My script is not giving the output for the last field and followed text (LA: Language English). Input file & script as follows: Input file: Thu Mar 19 2:34:14 EDT 2009 STC... (3 Replies)
Discussion started by: srsahu75
3 Replies

5. Shell Programming and Scripting

Help with a shell script to modify one line and copy the next 9 to same file

Hi everyone, the problem is quite simple, yet I can't find an easy solution using awk. I need to search for a string in $3, then if I find this string, copy the line,modify $3, and copy the next 9 lines to the same file. My problem is in the copying of the lines... Finding and modifying... (5 Replies)
Discussion started by: Teroc
5 Replies

6. Shell Programming and Scripting

Modify a file by another file: add new line and variable after string is found

hello, I have problem with writing/adjusting a shell script. I searched forum and unfortunately couldn't write scipt based on the information I found. I never wtire such so it's hard for me and I do need to modify one script immediately. case looks like: 1. 'file' that needs to be modified... (3 Replies)
Discussion started by: bipbip
3 Replies

7. Shell Programming and Scripting

Modify one line in a plain text file

Hi everyone, I want to know, if there is a way to modify one line in a text file with unix script, with out re-writing all the file. For example, i have this file: CONFIGURATION_1=XXXX CONFIGURATION_2=YYYY CONFIGURATION_3=ZZZZ supose i have a command or function "modify" that... (7 Replies)
Discussion started by: Xedrox
7 Replies

8. Shell Programming and Scripting

Extract certain sections of a line

I have a log that looks like below sc.mng_10_Err.20131020_000000.log:NCSSC_MNG_UP_PE_TO_BE : Failed to change dvc_trx_sts from PE to BE for srvtrx: 213323141427349 dvcsfx: 1 sc.mng_4_Err.20131020_000000.log:NCSSC_MNG_UP_PE_TO_BE : Failed to change dvc_trx_sts from PE to BE for srvtrx:... (6 Replies)
Discussion started by: senormarquez
6 Replies

9. Shell Programming and Scripting

Remove sections based on duplicate first line

Hi, I have a file with many sections in it. Each section is separated by a blank line. The first line of each section would determine if the section is duplicate or not. if the section is duplicate then remove the entire section from the file. below is the example of input and output.... (5 Replies)
Discussion started by: ahmedwaseem2000
5 Replies

10. UNIX for Beginners Questions & Answers

Modify text file if found multiple pattern match for every line.

Looking for help, i have input file like below and want to modify to expected output, if can without create additional file, hope can direct modify it. have 2 thing need do. 1st is adding a word (testplan generation off) after ! ! IPG: Tue Aug 07 14:31:17 2018 2nd is adding... (16 Replies)
Discussion started by: kttan
16 Replies
GPIV_T-AVG(1)						      General Commands Manual						     GPIV_T-AVG(1)

NAME
gpiv_t-avg - Calculates time-averaged mean and variances of PIV data. SYNOPSIS
gpiv_t-avg [-dn | --dir_name dir basename] [-df | --first_dir N] [-dl | --last_dir N] [-fb | --file_basename file basename] [-ff | --first_file N] [-fl | --last_file N] [-fx | --file_prefix] [-h | --help] [-n | --none] [-p | --print] [-relrms] [-uv | --print] [-v | --version] DESCRIPTION
gpiv_t-avg calculates mean and variances from a series of piv data resulting into time-averaged values. If no parameters are defined at the command line, standard parameters will be used that are defined in the script. This program does not use the parameter resources from libg- piv. Options -dn | --dir_name dir base-name The dir base-name represents the directory name without its last number. It is supposed that the last number in the directory name is a counter. -df | --first_dir Defines the counter N of the first directory number at which the analyses starts. -dl | --last_dir Last directory number N at which the analyses ends. -fb | --file_base_name file base-name The filename has to be given without its .piv extension. The file base-name represents the file name without its last number, before the extension. If not -fx key is used, it is supposed that the last number in the file name is a counter. The output will be written to dir base-name/file base-name.ta_mean.piv and dirname/filename.ta_sdev.piv at which mean values and variances are written respec- tively or to dirname/filename.ta_U.piv and to dirname/filename.ta_V.piv if -uv is used. -ff | --first_file Defines the counter Nof first file number at which the analyses starts. -fl | --last_file Last file number N at which the analyses ends. -fx | --file_prefix Prefix numbering to file base name. -h | --help On-line help. -n | --none Suppresses real execution. -p | --print Prints parameters, command line options and input and output filenames to stdout. -relrms Prints relative rms, related to the absolute mean value. -uv Writes U and v displacements/velocities to separate outputs. -v | --version Prints version information to standard output, then exits successfully. SEE ALSO gpivtools AUTHOR
Gerber Van der Graaf 19 Januari 2005 GPIV_T-AVG(1)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy